[{"data":1,"prerenderedAt":5165},["ShallowReactive",2],{"tutorials-python-how-to":3,"category-items-python-how-to":600,"content-/python-how-to/handle-binary-files":601},[4,22,31,40,49,58,67,76,86,94,103,112,121,130,139,148,158,167,176,185,194,203,212,222,231,240,249,258,267,276,285,297,306,315,324,333,342,351,362,371,380,389,398,407,418,427,436,445,454,463,472,483,492,501,510,519,528,539,548,557,566,575,584,593],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"slug":11,"order":12,"isParent":13,"icon":14,"_type":15,"_id":16,"_source":17,"_file":18,"_stem":19,"_extension":20,"children":21,"expanded":13},"/python-how-to/string-manipulation","python-how-to",false,"","String Manipulation","Learn essential string manipulation techniques in Python","string-manipulation",1,true,"pi pi-folder","markdown","content:python-how-to:1.string-manipulation.md","content","python-how-to/1.string-manipulation.md","python-how-to/1.string-manipulation","md",[22,31,40,49,58,67],{"_path":23,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":24,"description":25,"slug":26,"parentId":5,"order":27,"_type":15,"_id":28,"_source":17,"_file":29,"_stem":30,"_extension":20},"/python-how-to/split-join-strings","Split and Join Strings","Learn how to split strings into lists and join lists back into strings in Python","split-join-strings",2,"content:python-how-to:2.split-join-strings.md","python-how-to/2.split-join-strings.md","python-how-to/2.split-join-strings",{"_path":32,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":33,"description":34,"slug":35,"parentId":5,"order":36,"_type":15,"_id":37,"_source":17,"_file":38,"_stem":39,"_extension":20},"/python-how-to/remove-whitespace","Remove Whitespace","Learn how to clean up and remove unwanted whitespace from strings in Python","remove-whitespace",3,"content:python-how-to:3.remove-whitespace.md","python-how-to/3.remove-whitespace.md","python-how-to/3.remove-whitespace",{"_path":41,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":42,"description":43,"slug":44,"parentId":5,"order":45,"_type":15,"_id":46,"_source":17,"_file":47,"_stem":48,"_extension":20},"/python-how-to/find-replace-text","Find and Replace Text","Learn how to search for and replace text within strings in Python","find-replace-text",4,"content:python-how-to:4.find-replace-text.md","python-how-to/4.find-replace-text.md","python-how-to/4.find-replace-text",{"_path":50,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":51,"description":52,"slug":53,"parentId":5,"order":54,"_type":15,"_id":55,"_source":17,"_file":56,"_stem":57,"_extension":20},"/python-how-to/check-string-content","Check String Content","Learn how to validate and check the content of strings in Python","check-string-content",5,"content:python-how-to:5.check-string-content.md","python-how-to/5.check-string-content.md","python-how-to/5.check-string-content",{"_path":59,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":60,"description":61,"slug":62,"parentId":5,"order":63,"_type":15,"_id":64,"_source":17,"_file":65,"_stem":66,"_extension":20},"/python-how-to/format-strings","Format Strings","Learn how to format strings in Python using f-strings and format() method","format-strings",6,"content:python-how-to:6.format-strings.md","python-how-to/6.format-strings.md","python-how-to/6.format-strings",{"_path":68,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":69,"description":70,"slug":71,"parentId":5,"order":72,"_type":15,"_id":73,"_source":17,"_file":74,"_stem":75,"_extension":20},"/python-how-to/unicode-special-chars","Handle Unicode and Special Characters","Learn how to work with Unicode and special characters in Python strings","unicode-special-chars",7,"content:python-how-to:7.unicode-special-chars.md","python-how-to/7.unicode-special-chars.md","python-how-to/7.unicode-special-chars",{"_path":77,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":78,"description":79,"slug":80,"order":81,"isParent":13,"icon":14,"_type":15,"_id":82,"_source":17,"_file":83,"_stem":84,"_extension":20,"children":85,"expanded":13},"/python-how-to/list-operations","List Operations","Learn essential operations for working with lists in Python","list-operations",8,"content:python-how-to:8.list-operations.md","python-how-to/8.list-operations.md","python-how-to/8.list-operations",[86,94,103,112,121,130,139],{"_path":87,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":88,"description":89,"slug":90,"parentId":77,"order":81,"_type":15,"_id":91,"_source":17,"_file":92,"_stem":93,"_extension":20},"/python-how-to/sort-lists","Sort Lists","Learn how to sort lists in Python using different methods and custom sorting","sort-lists","content:python-how-to:9.sort-lists.md","python-how-to/9.sort-lists.md","python-how-to/9.sort-lists",{"_path":95,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":96,"description":97,"slug":98,"parentId":77,"order":99,"_type":15,"_id":100,"_source":17,"_file":101,"_stem":102,"_extension":20},"/python-how-to/remove-duplicates","Remove Duplicates","Learn how to remove duplicate elements from lists in Python","remove-duplicates",10,"content:python-how-to:10.remove-duplicates.md","python-how-to/10.remove-duplicates.md","python-how-to/10.remove-duplicates",{"_path":104,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":105,"description":106,"slug":107,"parentId":77,"order":108,"_type":15,"_id":109,"_source":17,"_file":110,"_stem":111,"_extension":20},"/python-how-to/filter-lists","Filter Lists","Learn how to filter lists in Python using different methods","filter-lists",11,"content:python-how-to:11.filter-lists.md","python-how-to/11.filter-lists.md","python-how-to/11.filter-lists",{"_path":113,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":114,"description":115,"slug":116,"parentId":77,"order":117,"_type":15,"_id":118,"_source":17,"_file":119,"_stem":120,"_extension":20},"/python-how-to/combine-lists","Combine Lists","Learn different methods to combine lists in Python","combine-lists",12,"content:python-how-to:12.combine-lists.md","python-how-to/12.combine-lists.md","python-how-to/12.combine-lists",{"_path":122,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":123,"description":124,"slug":125,"parentId":77,"order":126,"_type":15,"_id":127,"_source":17,"_file":128,"_stem":129,"_extension":20},"/python-how-to/list-comprehensions","Use List Comprehensions","Learn how to create and transform lists efficiently using Python's list comprehension syntax","list-comprehensions",13,"content:python-how-to:13.list-comprehensions.md","python-how-to/13.list-comprehensions.md","python-how-to/13.list-comprehensions",{"_path":131,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":132,"description":133,"slug":134,"parentId":77,"order":135,"_type":15,"_id":136,"_source":17,"_file":137,"_stem":138,"_extension":20},"/python-how-to/nested-lists","Work with Nested Lists","Learn how to work with nested lists (2D arrays) in Python","nested-lists",14,"content:python-how-to:14.nested-lists.md","python-how-to/14.nested-lists.md","python-how-to/14.nested-lists",{"_path":140,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":141,"description":142,"slug":143,"parentId":77,"order":144,"_type":15,"_id":145,"_source":17,"_file":146,"_stem":147,"_extension":20},"/python-how-to/enumerate-zip","Use enumerate() and zip()","Learn how to use enumerate() and zip() for efficient iteration in Python","enumerate-zip",15,"content:python-how-to:15.enumerate-zip.md","python-how-to/15.enumerate-zip.md","python-how-to/15.enumerate-zip",{"_path":149,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":150,"description":151,"slug":152,"order":153,"isParent":13,"icon":14,"_type":15,"_id":154,"_source":17,"_file":155,"_stem":156,"_extension":20,"children":157,"expanded":13},"/python-how-to/dictionary-operations","Dictionary Operations","Learn essential operations for working with dictionaries in Python","dictionary-operations",16,"content:python-how-to:16.dictionary-operations.md","python-how-to/16.dictionary-operations.md","python-how-to/16.dictionary-operations",[158,167,176,185,194,203],{"_path":159,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":160,"description":161,"slug":162,"parentId":149,"order":163,"_type":15,"_id":164,"_source":17,"_file":165,"_stem":166,"_extension":20},"/python-how-to/merge-dictionaries","Merge Dictionaries","Learn different methods to merge dictionaries in Python","merge-dictionaries",17,"content:python-how-to:17.merge-dictionaries.md","python-how-to/17.merge-dictionaries.md","python-how-to/17.merge-dictionaries",{"_path":168,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":169,"description":170,"slug":171,"parentId":149,"order":172,"_type":15,"_id":173,"_source":17,"_file":174,"_stem":175,"_extension":20},"/python-how-to/sort-dictionaries","Sort Dictionaries","Learn how to sort dictionaries by keys or values in Python","sort-dictionaries",18,"content:python-how-to:18.sort-dictionaries.md","python-how-to/18.sort-dictionaries.md","python-how-to/18.sort-dictionaries",{"_path":177,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":178,"description":179,"slug":180,"parentId":149,"order":181,"_type":15,"_id":182,"_source":17,"_file":183,"_stem":184,"_extension":20},"/python-how-to/filter-dictionaries","Filter Dictionaries","Learn how to filter dictionaries based on keys or values in Python","filter-dictionaries",19,"content:python-how-to:19.filter-dictionaries.md","python-how-to/19.filter-dictionaries.md","python-how-to/19.filter-dictionaries",{"_path":186,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":187,"description":188,"slug":189,"parentId":149,"order":190,"_type":15,"_id":191,"_source":17,"_file":192,"_stem":193,"_extension":20},"/python-how-to/handle-missing-keys","Handle Missing Keys","Learn safe ways to access dictionary keys and handle missing values","handle-missing-keys",20,"content:python-how-to:20.handle-missing-keys.md","python-how-to/20.handle-missing-keys.md","python-how-to/20.handle-missing-keys",{"_path":195,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":196,"description":197,"slug":198,"parentId":149,"order":199,"_type":15,"_id":200,"_source":17,"_file":201,"_stem":202,"_extension":20},"/python-how-to/dictionary-comprehensions","Use Dictionary Comprehensions","Learn how to create dictionaries efficiently using comprehensions","dictionary-comprehensions",21,"content:python-how-to:21.dictionary-comprehensions.md","python-how-to/21.dictionary-comprehensions.md","python-how-to/21.dictionary-comprehensions",{"_path":204,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":205,"description":206,"slug":207,"parentId":149,"order":208,"_type":15,"_id":209,"_source":17,"_file":210,"_stem":211,"_extension":20},"/python-how-to/convert-lists-dictionaries","Convert Between Lists and Dictionaries","Learn how to transform data between lists and dictionaries in Python","convert-lists-dictionaries",22,"content:python-how-to:22.convert-lists-dictionaries.md","python-how-to/22.convert-lists-dictionaries.md","python-how-to/22.convert-lists-dictionaries",{"_path":213,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":214,"description":215,"slug":216,"order":217,"isParent":13,"icon":14,"_type":15,"_id":218,"_source":17,"_file":219,"_stem":220,"_extension":20,"children":221,"expanded":13},"/python-how-to/file-operations","File Operations","Learn essential file operations in Python for reading, writing, and managing files","file-operations",23,"content:python-how-to:23.file-operations.md","python-how-to/23.file-operations.md","python-how-to/23.file-operations",[222,231,240,249,258,267,276],{"_path":223,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":224,"description":225,"slug":226,"parentId":213,"order":227,"_type":15,"_id":228,"_source":17,"_file":229,"_stem":230,"_extension":20},"/python-how-to/read-text-files","Read Text Files","Learn how to read text files in Python using different methods","read-text-files",24,"content:python-how-to:24.read-text-files.md","python-how-to/24.read-text-files.md","python-how-to/24.read-text-files",{"_path":232,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":233,"description":234,"slug":235,"parentId":213,"order":236,"_type":15,"_id":237,"_source":17,"_file":238,"_stem":239,"_extension":20},"/python-how-to/write-to-files","Write to Files","Learn how to write and create files in Python using different methods","write-to-files",25,"content:python-how-to:25.write-to-files.md","python-how-to/25.write-to-files.md","python-how-to/25.write-to-files",{"_path":241,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":242,"description":243,"slug":244,"parentId":213,"order":245,"_type":15,"_id":246,"_source":17,"_file":247,"_stem":248,"_extension":20},"/python-how-to/work-csv-files","Work with CSV Files","Learn how to read and write CSV files in Python using the csv module","work-csv-files",26,"content:python-how-to:26.work-csv-files.md","python-how-to/26.work-csv-files.md","python-how-to/26.work-csv-files",{"_path":250,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":251,"description":252,"slug":253,"parentId":213,"order":254,"_type":15,"_id":255,"_source":17,"_file":256,"_stem":257,"_extension":20},"/python-how-to/handle-file-paths","Handle File Paths","Learn how to work with file and directory paths in Python using pathlib and os modules","handle-file-paths",27,"content:python-how-to:27.handle-file-paths.md","python-how-to/27.handle-file-paths.md","python-how-to/27.handle-file-paths",{"_path":259,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":260,"description":261,"slug":262,"parentId":213,"order":263,"_type":15,"_id":264,"_source":17,"_file":265,"_stem":266,"_extension":20},"/python-how-to/work-json-files","Work with JSON Files","Learn how to read and write JSON files in Python using the json module","work-json-files",28,"content:python-how-to:28.work-json-files.md","python-how-to/28.work-json-files.md","python-how-to/28.work-json-files",{"_path":268,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":269,"description":270,"slug":271,"parentId":213,"order":272,"_type":15,"_id":273,"_source":17,"_file":274,"_stem":275,"_extension":20},"/python-how-to/handle-binary-files","Handle Binary Files","Learn how to work with binary files in Python for images, data, and other non-text content","handle-binary-files",29,"content:python-how-to:29.handle-binary-files.md","python-how-to/29.handle-binary-files.md","python-how-to/29.handle-binary-files",{"_path":277,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":278,"description":279,"slug":280,"parentId":213,"order":281,"_type":15,"_id":282,"_source":17,"_file":283,"_stem":284,"_extension":20},"/python-how-to/use-context-managers","Use Context Managers","Learn how to use context managers for safe resource handling in Python","use-context-managers",30,"content:python-how-to:30.use-context-managers.md","python-how-to/30.use-context-managers.md","python-how-to/30.use-context-managers",{"_path":286,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":287,"description":288,"slug":289,"parentId":290,"order":291,"isParent":13,"icon":292,"_type":15,"_id":293,"_source":17,"_file":294,"_stem":295,"_extension":20,"children":296},"/python-how-to/date-and-time","Date and Time","Master Python's date and time handling with datetime, time zones, formatting, and calculations","date-and-time","/python-how-to",31,"pi pi-calendar","content:python-how-to:31.date-and-time.md","python-how-to/31.date-and-time.md","python-how-to/31.date-and-time",[297,306,315,324,333,342],{"_path":298,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":299,"description":300,"slug":301,"parentId":286,"order":302,"_type":15,"_id":303,"_source":17,"_file":304,"_stem":305,"_extension":20},"/python-how-to/get-current-datetime","Get Current Date/Time","Learn how to get current date, time, and timestamps using Python's datetime module","get-current-datetime",32,"content:python-how-to:32.get-current-datetime.md","python-how-to/32.get-current-datetime.md","python-how-to/32.get-current-datetime",{"_path":307,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":308,"description":309,"slug":310,"parentId":286,"order":311,"_type":15,"_id":312,"_source":17,"_file":313,"_stem":314,"_extension":20},"/python-how-to/format-dates","Format Dates","Master date formatting with strftime, custom formats, and locale-aware formatting for user-friendly displays","format-dates",33,"content:python-how-to:33.format-dates.md","python-how-to/33.format-dates.md","python-how-to/33.format-dates",{"_path":316,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":317,"description":318,"slug":319,"parentId":286,"order":320,"_type":15,"_id":321,"_source":17,"_file":322,"_stem":323,"_extension":20},"/python-how-to/calculate-date-differences","Calculate Date Differences","Learn to calculate time differences, durations, and intervals using Python's timedelta for scheduling and analytics","calculate-date-differences",34,"content:python-how-to:34.calculate-date-differences.md","python-how-to/34.calculate-date-differences.md","python-how-to/34.calculate-date-differences",{"_path":325,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":326,"description":327,"slug":328,"parentId":286,"order":329,"_type":15,"_id":330,"_source":17,"_file":331,"_stem":332,"_extension":20},"/python-how-to/parse-date-strings","Parse Date Strings","Convert text dates into Python datetime objects using strptime, handle multiple formats, and validate date input","parse-date-strings",35,"content:python-how-to:35.parse-date-strings.md","python-how-to/35.parse-date-strings.md","python-how-to/35.parse-date-strings",{"_path":334,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":335,"description":336,"slug":337,"parentId":286,"order":338,"_type":15,"_id":339,"_source":17,"_file":340,"_stem":341,"_extension":20},"/python-how-to/handle-timezones","Handle Timezones","Master timezone handling with zoneinfo, UTC conversions, and timezone-aware datetime objects for global applications","handle-timezones",36,"content:python-how-to:36.handle-timezones.md","python-how-to/36.handle-timezones.md","python-how-to/36.handle-timezones",{"_path":343,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":344,"description":345,"slug":346,"parentId":286,"order":347,"_type":15,"_id":348,"_source":17,"_file":349,"_stem":350,"_extension":20},"/python-how-to/work-with-timestamps","Work with Timestamps","Master Unix timestamps in Python - convert between datetime objects and timestamps for APIs, databases, and system integration","work-with-timestamps",37,"content:python-how-to:37.work-with-timestamps.md","python-how-to/37.work-with-timestamps.md","python-how-to/37.work-with-timestamps",{"_path":352,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":353,"description":354,"slug":355,"parentId":290,"order":356,"isParent":13,"icon":357,"_type":15,"_id":358,"_source":17,"_file":359,"_stem":360,"_extension":20,"children":361},"/python-how-to/error-handling","Error Handling","Learn Python's error handling with try/except, custom exceptions, debugging, logging, and retry logic for robust applications","error-handling",38,"pi pi-exclamation-triangle","content:python-how-to:38.error-handling.md","python-how-to/38.error-handling.md","python-how-to/38.error-handling",[362,371,380,389,398],{"_path":363,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":364,"description":365,"slug":366,"parentId":352,"order":367,"_type":15,"_id":368,"_source":17,"_file":369,"_stem":370,"_extension":20},"/python-how-to/handle-exceptions","Handle Exceptions","Master try/except blocks, multiple exception handling, and finally clauses for robust error handling in Python","handle-exceptions",39,"content:python-how-to:39.handle-exceptions.md","python-how-to/39.handle-exceptions.md","python-how-to/39.handle-exceptions",{"_path":372,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":373,"description":374,"slug":375,"parentId":352,"order":376,"_type":15,"_id":377,"_source":17,"_file":378,"_stem":379,"_extension":20},"/python-how-to/create-custom-exceptions","Create Custom Exceptions","Learn to create custom exception classes in Python for specific error handling and better code organization","create-custom-exceptions",40,"content:python-how-to:40.create-custom-exceptions.md","python-how-to/40.create-custom-exceptions.md","python-how-to/40.create-custom-exceptions",{"_path":381,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":382,"description":383,"slug":384,"parentId":352,"order":385,"_type":15,"_id":386,"_source":17,"_file":387,"_stem":388,"_extension":20},"/python-how-to/debug-code","Debug Code","Learn Python debugging techniques using print statements, the debugger, and tools to find and fix code issues","debug-code",41,"content:python-how-to:41.debug-code.md","python-how-to/41.debug-code.md","python-how-to/41.debug-code",{"_path":390,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":391,"description":392,"slug":393,"parentId":352,"order":394,"_type":15,"_id":395,"_source":17,"_file":396,"_stem":397,"_extension":20},"/python-how-to/use-logging","Use Logging","Learn Python's logging module for tracking application behavior, errors, and debugging information","use-logging",42,"content:python-how-to:42.use-logging.md","python-how-to/42.use-logging.md","python-how-to/42.use-logging",{"_path":399,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":400,"description":401,"slug":402,"parentId":352,"order":403,"_type":15,"_id":404,"_source":17,"_file":405,"_stem":406,"_extension":20},"/python-how-to/implement-retry-logic","Implement Retry Logic","Learn to implement retry mechanisms in Python for handling temporary failures and building resilient applications","implement-retry-logic",43,"content:python-how-to:43.implement-retry-logic.md","python-how-to/43.implement-retry-logic.md","python-how-to/43.implement-retry-logic",{"_path":408,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":409,"description":410,"slug":411,"parentId":290,"order":412,"isParent":13,"icon":413,"_type":15,"_id":414,"_source":17,"_file":415,"_stem":416,"_extension":20,"children":417},"/python-how-to/functions-and-modules","Functions and Modules","Learn Python functions, modules, and code organization for building reusable, maintainable applications","functions-and-modules",44,"pi pi-box","content:python-how-to:44.functions-and-modules.md","python-how-to/44.functions-and-modules.md","python-how-to/44.functions-and-modules",[418,427,436,445,454,463],{"_path":419,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":420,"description":421,"slug":422,"parentId":408,"order":423,"_type":15,"_id":424,"_source":17,"_file":425,"_stem":426,"_extension":20},"/python-how-to/write-functions","Write Functions","Learn to create Python functions with parameters, return values, and documentation for reusable code","write-functions",45,"content:python-how-to:45.write-functions.md","python-how-to/45.write-functions.md","python-how-to/45.write-functions",{"_path":428,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":429,"description":430,"slug":431,"parentId":408,"order":432,"_type":15,"_id":433,"_source":17,"_file":434,"_stem":435,"_extension":20},"/python-how-to/use-args-kwargs","Use *args and **kwargs","Learn to use *args and **kwargs for flexible function arguments in Python","use-args-kwargs",46,"content:python-how-to:46.use-args-kwargs.md","python-how-to/46.use-args-kwargs.md","python-how-to/46.use-args-kwargs",{"_path":437,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":438,"description":439,"slug":440,"parentId":408,"order":441,"_type":15,"_id":442,"_source":17,"_file":443,"_stem":444,"_extension":20},"/python-how-to/create-decorators","Create Decorators","Learn to create and use Python decorators to enhance function behavior and add functionality","create-decorators",47,"content:python-how-to:47.create-decorators.md","python-how-to/47.create-decorators.md","python-how-to/47.create-decorators",{"_path":446,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":447,"description":448,"slug":449,"parentId":408,"order":450,"_type":15,"_id":451,"_source":17,"_file":452,"_stem":453,"_extension":20},"/python-how-to/use-generators","Use Generators","Learn to create memory-efficient generators with yield for processing large datasets and sequences","use-generators",48,"content:python-how-to:48.use-generators.md","python-how-to/48.use-generators.md","python-how-to/48.use-generators",{"_path":455,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":456,"description":457,"slug":458,"parentId":408,"order":459,"_type":15,"_id":460,"_source":17,"_file":461,"_stem":462,"_extension":20},"/python-how-to/work-modules-packages","Work with Modules and Packages","Learn to organize Python code with modules and packages, and use imports effectively","work-modules-packages",49,"content:python-how-to:49.work-modules-packages.md","python-how-to/49.work-modules-packages.md","python-how-to/49.work-modules-packages",{"_path":464,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":465,"description":466,"slug":467,"parentId":408,"order":468,"_type":15,"_id":469,"_source":17,"_file":470,"_stem":471,"_extension":20},"/python-how-to/create-virtual-environments","Create Virtual Environments","Learn to create and manage Python virtual environments for project dependency isolation","create-virtual-environments",50,"content:python-how-to:50.create-virtual-environments.md","python-how-to/50.create-virtual-environments.md","python-how-to/50.create-virtual-environments",{"_path":473,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":474,"description":475,"slug":476,"parentId":290,"order":477,"isParent":13,"icon":478,"_type":15,"_id":479,"_source":17,"_file":480,"_stem":481,"_extension":20,"children":482},"/python-how-to/data-processing","Data Processing","Learn Python data processing techniques including regex, APIs, databases, and large file handling","data-processing",51,"pi pi-database","content:python-how-to:51.data-processing.md","python-how-to/51.data-processing.md","python-how-to/51.data-processing",[483,492,501,510,519],{"_path":484,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":485,"description":486,"slug":487,"parentId":473,"order":488,"_type":15,"_id":489,"_source":17,"_file":490,"_stem":491,"_extension":20},"/python-how-to/work-regular-expressions","Work with Regular Expressions","Learn to use Python's re module for pattern matching, text extraction, and data validation","work-regular-expressions",52,"content:python-how-to:52.work-regular-expressions.md","python-how-to/52.work-regular-expressions.md","python-how-to/52.work-regular-expressions",{"_path":493,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":494,"description":495,"slug":496,"parentId":473,"order":497,"_type":15,"_id":498,"_source":17,"_file":499,"_stem":500,"_extension":20},"/python-how-to/parse-xml-html","Parse XML and HTML","Learn to extract data from XML and HTML documents using Python's built-in parsing tools","parse-xml-html",53,"content:python-how-to:53.parse-xml-html.md","python-how-to/53.parse-xml-html.md","python-how-to/53.parse-xml-html",{"_path":502,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":503,"description":504,"slug":505,"parentId":473,"order":506,"_type":15,"_id":507,"_source":17,"_file":508,"_stem":509,"_extension":20},"/python-how-to/handle-api-requests","Handle API Requests","Learn to fetch and process data from web APIs using Python's urllib and external requests library","handle-api-requests",54,"content:python-how-to:54.handle-api-requests.md","python-how-to/54.handle-api-requests.md","python-how-to/54.handle-api-requests",{"_path":511,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":512,"description":513,"slug":514,"parentId":473,"order":515,"_type":15,"_id":516,"_source":17,"_file":517,"_stem":518,"_extension":20},"/python-how-to/work-databases","Work with Databases","Learn to connect to and query SQL databases using Python's sqlite3 and database techniques","work-databases",55,"content:python-how-to:55.work-databases.md","python-how-to/55.work-databases.md","python-how-to/55.work-databases",{"_path":520,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":521,"description":522,"slug":523,"parentId":473,"order":524,"_type":15,"_id":525,"_source":17,"_file":526,"_stem":527,"_extension":20},"/python-how-to/process-large-files","Process Large Files","Learn memory-efficient techniques for handling large files and datasets in Python","process-large-files",56,"content:python-how-to:56.process-large-files.md","python-how-to/56.process-large-files.md","python-how-to/56.process-large-files",{"_path":529,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":530,"description":531,"slug":532,"parentId":290,"order":533,"isParent":13,"icon":534,"_type":15,"_id":535,"_source":17,"_file":536,"_stem":537,"_extension":20,"children":538},"/python-how-to/best-practices","Best Practices","Learn Python best practices for writing clean, maintainable, and efficient code","best-practices",57,"pi pi-star","content:python-how-to:57.best-practices.md","python-how-to/57.best-practices.md","python-how-to/57.best-practices",[539,548,557,566,575,584],{"_path":540,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":541,"description":542,"slug":543,"parentId":529,"order":544,"_type":15,"_id":545,"_source":17,"_file":546,"_stem":547,"_extension":20},"/python-how-to/structure-code","Structure Your Code","Learn to organize Python code with proper module structure, functions, and classes","structure-code",58,"content:python-how-to:58.structure-code.md","python-how-to/58.structure-code.md","python-how-to/58.structure-code",{"_path":549,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":550,"description":551,"slug":552,"parentId":529,"order":553,"_type":15,"_id":554,"_source":17,"_file":555,"_stem":556,"_extension":20},"/python-how-to/write-clean-code","Write Clean Code","Learn to write readable, maintainable Python code with proper naming, comments, and clear logic","write-clean-code",59,"content:python-how-to:59.write-clean-code.md","python-how-to/59.write-clean-code.md","python-how-to/59.write-clean-code",{"_path":558,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":559,"description":560,"slug":561,"parentId":529,"order":562,"_type":15,"_id":563,"_source":17,"_file":564,"_stem":565,"_extension":20},"/python-how-to/optimize-performance","Optimize Performance","Learn to identify and fix performance bottlenecks in Python code for faster execution","optimize-performance",60,"content:python-how-to:60.optimize-performance.md","python-how-to/60.optimize-performance.md","python-how-to/60.optimize-performance",{"_path":567,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":568,"description":569,"slug":570,"parentId":529,"order":571,"_type":15,"_id":572,"_source":17,"_file":573,"_stem":574,"_extension":20},"/python-how-to/write-unit-tests","Write Unit Tests","Learn to create reliable unit tests to verify your Python code works correctly and catch bugs early","write-unit-tests",61,"content:python-how-to:61.write-unit-tests.md","python-how-to/61.write-unit-tests.md","python-how-to/61.write-unit-tests",{"_path":576,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":577,"description":578,"slug":579,"parentId":529,"order":580,"_type":15,"_id":581,"_source":17,"_file":582,"_stem":583,"_extension":20},"/python-how-to/document-code","Document Your Code","Learn to write clear documentation and helpful comments for your Python code","document-code",62,"content:python-how-to:62.document-code.md","python-how-to/62.document-code.md","python-how-to/62.document-code",{"_path":585,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":587,"slug":588,"parentId":529,"order":589,"_type":15,"_id":590,"_source":17,"_file":591,"_stem":592,"_extension":20},"/python-how-to/use-type-hints","Use Type Hints","Learn to add type annotations to Python code for better clarity, tooling support, and error detection","use-type-hints",63,"content:python-how-to:63.use-type-hints.md","python-how-to/63.use-type-hints.md","python-how-to/63.use-type-hints",{"_path":290,"_dir":8,"_draft":7,"_partial":7,"_locale":8,"title":594,"description":595,"slug":6,"order":596,"icon":14,"_type":15,"_id":597,"_source":17,"_file":598,"_stem":599,"_extension":20},"Python How-To Guide","Practical Python tutorials for common programming tasks. Learn step-by-step solutions for string manipulation, file operations, data processing, and more with real-world examples.",0,"content:python-how-to:index.md","python-how-to/index.md","python-how-to/index",[267],{"_path":268,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":269,"description":270,"slug":271,"parentId":213,"order":272,"body":602,"_type":15,"_id":273,"_source":17,"_file":274,"_stem":275,"_extension":20},{"type":603,"children":604,"toc":5149},"root",[605,614,620,856,863,868,979,986,1321,1327,1767,1773,2365,2371,2760,2766,2771,2777,3134,3140,3756,3762,4183,4189,4830,4836,5002,5008,5143],{"type":606,"tag":607,"props":608,"children":610},"element","h1",{"id":609},"handling-binary-files",[611],{"type":612,"value":613},"text","💾 Handling Binary Files",{"type":606,"tag":615,"props":616,"children":617},"p",{},[618],{"type":612,"value":619},"Binary files contain non-text data like images, executables, or compressed data. Python provides tools to read, write, and manipulate binary files safely and efficiently.",{"type":606,"tag":621,"props":622,"children":623},"code-try",{},[624],{"type":606,"tag":625,"props":626,"children":630},"pre",{"className":627,"code":628,"language":629,"meta":8,"style":8},"language-python shiki shiki-themes github-light github-dark","# Basic binary file operations\n# Read binary file\nwith open('image.jpg', 'rb') as file:\n    data = file.read()\n    print(f\"File size: {len(data)} bytes\")\n\n# Write binary file\nwith open('copy.jpg', 'wb') as file:\n    file.write(data)\n","python",[631],{"type":606,"tag":632,"props":633,"children":634},"code",{"__ignoreMap":8},[635,646,654,712,734,781,789,797,842],{"type":606,"tag":636,"props":637,"children":639},"span",{"class":638,"line":12},"line",[640],{"type":606,"tag":636,"props":641,"children":643},{"style":642},"--shiki-default:#6A737D;--shiki-app-dark-mode:#6A737D",[644],{"type":612,"value":645},"# Basic binary file operations\n",{"type":606,"tag":636,"props":647,"children":648},{"class":638,"line":27},[649],{"type":606,"tag":636,"props":650,"children":651},{"style":642},[652],{"type":612,"value":653},"# Read binary file\n",{"type":606,"tag":636,"props":655,"children":656},{"class":638,"line":36},[657,663,669,675,681,686,691,696,701,707],{"type":606,"tag":636,"props":658,"children":660},{"style":659},"--shiki-default:#D73A49;--shiki-app-dark-mode:#F97583",[661],{"type":612,"value":662},"with",{"type":606,"tag":636,"props":664,"children":666},{"style":665},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[667],{"type":612,"value":668}," open",{"type":606,"tag":636,"props":670,"children":672},{"style":671},"--shiki-default:#24292E;--shiki-app-dark-mode:#E1E4E8",[673],{"type":612,"value":674},"(",{"type":606,"tag":636,"props":676,"children":678},{"style":677},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[679],{"type":612,"value":680},"'image.jpg'",{"type":606,"tag":636,"props":682,"children":683},{"style":671},[684],{"type":612,"value":685},", ",{"type":606,"tag":636,"props":687,"children":688},{"style":677},[689],{"type":612,"value":690},"'rb'",{"type":606,"tag":636,"props":692,"children":693},{"style":671},[694],{"type":612,"value":695},") ",{"type":606,"tag":636,"props":697,"children":698},{"style":659},[699],{"type":612,"value":700},"as",{"type":606,"tag":636,"props":702,"children":704},{"style":703},"--shiki-default:#E36209;--shiki-app-dark-mode:#FFAB70",[705],{"type":612,"value":706}," file",{"type":606,"tag":636,"props":708,"children":709},{"style":671},[710],{"type":612,"value":711},":\n",{"type":606,"tag":636,"props":713,"children":714},{"class":638,"line":45},[715,720,725,729],{"type":606,"tag":636,"props":716,"children":717},{"style":671},[718],{"type":612,"value":719},"    data ",{"type":606,"tag":636,"props":721,"children":722},{"style":659},[723],{"type":612,"value":724},"=",{"type":606,"tag":636,"props":726,"children":727},{"style":703},[728],{"type":612,"value":706},{"type":606,"tag":636,"props":730,"children":731},{"style":671},[732],{"type":612,"value":733},".read()\n",{"type":606,"tag":636,"props":735,"children":736},{"class":638,"line":54},[737,742,746,751,756,761,766,771,776],{"type":606,"tag":636,"props":738,"children":739},{"style":665},[740],{"type":612,"value":741},"    print",{"type":606,"tag":636,"props":743,"children":744},{"style":671},[745],{"type":612,"value":674},{"type":606,"tag":636,"props":747,"children":748},{"style":659},[749],{"type":612,"value":750},"f",{"type":606,"tag":636,"props":752,"children":753},{"style":677},[754],{"type":612,"value":755},"\"File size: ",{"type":606,"tag":636,"props":757,"children":758},{"style":665},[759],{"type":612,"value":760},"{len",{"type":606,"tag":636,"props":762,"children":763},{"style":671},[764],{"type":612,"value":765},"(data)",{"type":606,"tag":636,"props":767,"children":768},{"style":665},[769],{"type":612,"value":770},"}",{"type":606,"tag":636,"props":772,"children":773},{"style":677},[774],{"type":612,"value":775}," bytes\"",{"type":606,"tag":636,"props":777,"children":778},{"style":671},[779],{"type":612,"value":780},")\n",{"type":606,"tag":636,"props":782,"children":783},{"class":638,"line":63},[784],{"type":606,"tag":636,"props":785,"children":786},{"emptyLinePlaceholder":13},[787],{"type":612,"value":788},"\n",{"type":606,"tag":636,"props":790,"children":791},{"class":638,"line":72},[792],{"type":606,"tag":636,"props":793,"children":794},{"style":642},[795],{"type":612,"value":796},"# Write binary file\n",{"type":606,"tag":636,"props":798,"children":799},{"class":638,"line":81},[800,804,808,812,817,821,826,830,834,838],{"type":606,"tag":636,"props":801,"children":802},{"style":659},[803],{"type":612,"value":662},{"type":606,"tag":636,"props":805,"children":806},{"style":665},[807],{"type":612,"value":668},{"type":606,"tag":636,"props":809,"children":810},{"style":671},[811],{"type":612,"value":674},{"type":606,"tag":636,"props":813,"children":814},{"style":677},[815],{"type":612,"value":816},"'copy.jpg'",{"type":606,"tag":636,"props":818,"children":819},{"style":671},[820],{"type":612,"value":685},{"type":606,"tag":636,"props":822,"children":823},{"style":677},[824],{"type":612,"value":825},"'wb'",{"type":606,"tag":636,"props":827,"children":828},{"style":671},[829],{"type":612,"value":695},{"type":606,"tag":636,"props":831,"children":832},{"style":659},[833],{"type":612,"value":700},{"type":606,"tag":636,"props":835,"children":836},{"style":703},[837],{"type":612,"value":706},{"type":606,"tag":636,"props":839,"children":840},{"style":671},[841],{"type":612,"value":711},{"type":606,"tag":636,"props":843,"children":845},{"class":638,"line":844},9,[846,851],{"type":606,"tag":636,"props":847,"children":848},{"style":703},[849],{"type":612,"value":850},"    file",{"type":606,"tag":636,"props":852,"children":853},{"style":671},[854],{"type":612,"value":855},".write(data)\n",{"type":606,"tag":857,"props":858,"children":860},"h2",{"id":859},"binary-file-modes",[861],{"type":612,"value":862},"🎯 Binary File Modes",{"type":606,"tag":615,"props":864,"children":865},{},[866],{"type":612,"value":867},"Python offers specific modes for binary file operations.",{"type":606,"tag":869,"props":870,"children":874},"info-box",{"emoji":871,"title":872,"type":873},"📝","Binary File Modes","info",[875,884,910,918,953,961],{"type":606,"tag":615,"props":876,"children":877},{},[878],{"type":606,"tag":879,"props":880,"children":881},"strong",{},[882],{"type":612,"value":883},"Read Modes:",{"type":606,"tag":885,"props":886,"children":887},"ul",{},[888,899],{"type":606,"tag":889,"props":890,"children":891},"li",{},[892,897],{"type":606,"tag":632,"props":893,"children":895},{"className":894},[],[896],{"type":612,"value":690},{"type":612,"value":898},": Read binary",{"type":606,"tag":889,"props":900,"children":901},{},[902,908],{"type":606,"tag":632,"props":903,"children":905},{"className":904},[],[906],{"type":612,"value":907},"'rb+'",{"type":612,"value":909},": Read/write binary",{"type":606,"tag":615,"props":911,"children":912},{},[913],{"type":606,"tag":879,"props":914,"children":915},{},[916],{"type":612,"value":917},"Write Modes:",{"type":606,"tag":885,"props":919,"children":920},{},[921,931,942],{"type":606,"tag":889,"props":922,"children":923},{},[924,929],{"type":606,"tag":632,"props":925,"children":927},{"className":926},[],[928],{"type":612,"value":825},{"type":612,"value":930},": Write binary (overwrites)",{"type":606,"tag":889,"props":932,"children":933},{},[934,940],{"type":606,"tag":632,"props":935,"children":937},{"className":936},[],[938],{"type":612,"value":939},"'ab'",{"type":612,"value":941},": Append binary",{"type":606,"tag":889,"props":943,"children":944},{},[945,951],{"type":606,"tag":632,"props":946,"children":948},{"className":947},[],[949],{"type":612,"value":950},"'wb+'",{"type":612,"value":952},": Write/read binary",{"type":606,"tag":615,"props":954,"children":955},{},[956],{"type":606,"tag":879,"props":957,"children":958},{},[959],{"type":612,"value":960},"Key Differences:",{"type":606,"tag":885,"props":962,"children":963},{},[964,969,974],{"type":606,"tag":889,"props":965,"children":966},{},[967],{"type":612,"value":968},"No encoding/decoding",{"type":606,"tag":889,"props":970,"children":971},{},[972],{"type":612,"value":973},"Returns bytes objects",{"type":606,"tag":889,"props":975,"children":976},{},[977],{"type":612,"value":978},"Exact byte preservation",{"type":606,"tag":980,"props":981,"children":983},"h3",{"id":982},"reading-binary-files",[984],{"type":612,"value":985},"Reading Binary Files",{"type":606,"tag":621,"props":987,"children":988},{},[989],{"type":606,"tag":625,"props":990,"children":992},{"className":627,"code":991,"language":629,"meta":8,"style":8},"import os\n\n# Reading binary files in chunks\ndef read_binary_file(filename, chunk_size=1024):\n    \"\"\"Read binary file in chunks\"\"\"\n    try:\n        with open(filename, 'rb') as file:\n            while True:\n                chunk = file.read(chunk_size)\n                if not chunk:\n                    break\n                print(f\"Read chunk of {len(chunk)} bytes\")\n                # Process chunk here\n    except FileNotFoundError:\n        print(f\"File {filename} not found\")\n\n# Example usage\nread_binary_file('example.bin')\n",[993],{"type":606,"tag":632,"props":994,"children":995},{"__ignoreMap":8},[996,1009,1016,1024,1057,1065,1077,1114,1131,1152,1170,1178,1220,1228,1245,1289,1296,1304],{"type":606,"tag":636,"props":997,"children":998},{"class":638,"line":12},[999,1004],{"type":606,"tag":636,"props":1000,"children":1001},{"style":659},[1002],{"type":612,"value":1003},"import",{"type":606,"tag":636,"props":1005,"children":1006},{"style":671},[1007],{"type":612,"value":1008}," os\n",{"type":606,"tag":636,"props":1010,"children":1011},{"class":638,"line":27},[1012],{"type":606,"tag":636,"props":1013,"children":1014},{"emptyLinePlaceholder":13},[1015],{"type":612,"value":788},{"type":606,"tag":636,"props":1017,"children":1018},{"class":638,"line":36},[1019],{"type":606,"tag":636,"props":1020,"children":1021},{"style":642},[1022],{"type":612,"value":1023},"# Reading binary files in chunks\n",{"type":606,"tag":636,"props":1025,"children":1026},{"class":638,"line":45},[1027,1032,1038,1043,1047,1052],{"type":606,"tag":636,"props":1028,"children":1029},{"style":659},[1030],{"type":612,"value":1031},"def",{"type":606,"tag":636,"props":1033,"children":1035},{"style":1034},"--shiki-default:#6F42C1;--shiki-app-dark-mode:#B392F0",[1036],{"type":612,"value":1037}," read_binary_file",{"type":606,"tag":636,"props":1039,"children":1040},{"style":671},[1041],{"type":612,"value":1042},"(filename, chunk_size",{"type":606,"tag":636,"props":1044,"children":1045},{"style":659},[1046],{"type":612,"value":724},{"type":606,"tag":636,"props":1048,"children":1049},{"style":665},[1050],{"type":612,"value":1051},"1024",{"type":606,"tag":636,"props":1053,"children":1054},{"style":671},[1055],{"type":612,"value":1056},"):\n",{"type":606,"tag":636,"props":1058,"children":1059},{"class":638,"line":54},[1060],{"type":606,"tag":636,"props":1061,"children":1062},{"style":677},[1063],{"type":612,"value":1064},"    \"\"\"Read binary file in chunks\"\"\"\n",{"type":606,"tag":636,"props":1066,"children":1067},{"class":638,"line":63},[1068,1073],{"type":606,"tag":636,"props":1069,"children":1070},{"style":659},[1071],{"type":612,"value":1072},"    try",{"type":606,"tag":636,"props":1074,"children":1075},{"style":671},[1076],{"type":612,"value":711},{"type":606,"tag":636,"props":1078,"children":1079},{"class":638,"line":72},[1080,1085,1089,1094,1098,1102,1106,1110],{"type":606,"tag":636,"props":1081,"children":1082},{"style":659},[1083],{"type":612,"value":1084},"        with",{"type":606,"tag":636,"props":1086,"children":1087},{"style":665},[1088],{"type":612,"value":668},{"type":606,"tag":636,"props":1090,"children":1091},{"style":671},[1092],{"type":612,"value":1093},"(filename, ",{"type":606,"tag":636,"props":1095,"children":1096},{"style":677},[1097],{"type":612,"value":690},{"type":606,"tag":636,"props":1099,"children":1100},{"style":671},[1101],{"type":612,"value":695},{"type":606,"tag":636,"props":1103,"children":1104},{"style":659},[1105],{"type":612,"value":700},{"type":606,"tag":636,"props":1107,"children":1108},{"style":703},[1109],{"type":612,"value":706},{"type":606,"tag":636,"props":1111,"children":1112},{"style":671},[1113],{"type":612,"value":711},{"type":606,"tag":636,"props":1115,"children":1116},{"class":638,"line":81},[1117,1122,1127],{"type":606,"tag":636,"props":1118,"children":1119},{"style":659},[1120],{"type":612,"value":1121},"            while",{"type":606,"tag":636,"props":1123,"children":1124},{"style":665},[1125],{"type":612,"value":1126}," True",{"type":606,"tag":636,"props":1128,"children":1129},{"style":671},[1130],{"type":612,"value":711},{"type":606,"tag":636,"props":1132,"children":1133},{"class":638,"line":844},[1134,1139,1143,1147],{"type":606,"tag":636,"props":1135,"children":1136},{"style":671},[1137],{"type":612,"value":1138},"                chunk ",{"type":606,"tag":636,"props":1140,"children":1141},{"style":659},[1142],{"type":612,"value":724},{"type":606,"tag":636,"props":1144,"children":1145},{"style":703},[1146],{"type":612,"value":706},{"type":606,"tag":636,"props":1148,"children":1149},{"style":671},[1150],{"type":612,"value":1151},".read(chunk_size)\n",{"type":606,"tag":636,"props":1153,"children":1154},{"class":638,"line":99},[1155,1160,1165],{"type":606,"tag":636,"props":1156,"children":1157},{"style":659},[1158],{"type":612,"value":1159},"                if",{"type":606,"tag":636,"props":1161,"children":1162},{"style":659},[1163],{"type":612,"value":1164}," not",{"type":606,"tag":636,"props":1166,"children":1167},{"style":671},[1168],{"type":612,"value":1169}," chunk:\n",{"type":606,"tag":636,"props":1171,"children":1172},{"class":638,"line":108},[1173],{"type":606,"tag":636,"props":1174,"children":1175},{"style":659},[1176],{"type":612,"value":1177},"                    break\n",{"type":606,"tag":636,"props":1179,"children":1180},{"class":638,"line":117},[1181,1186,1190,1194,1199,1203,1208,1212,1216],{"type":606,"tag":636,"props":1182,"children":1183},{"style":665},[1184],{"type":612,"value":1185},"                print",{"type":606,"tag":636,"props":1187,"children":1188},{"style":671},[1189],{"type":612,"value":674},{"type":606,"tag":636,"props":1191,"children":1192},{"style":659},[1193],{"type":612,"value":750},{"type":606,"tag":636,"props":1195,"children":1196},{"style":677},[1197],{"type":612,"value":1198},"\"Read chunk of ",{"type":606,"tag":636,"props":1200,"children":1201},{"style":665},[1202],{"type":612,"value":760},{"type":606,"tag":636,"props":1204,"children":1205},{"style":671},[1206],{"type":612,"value":1207},"(chunk)",{"type":606,"tag":636,"props":1209,"children":1210},{"style":665},[1211],{"type":612,"value":770},{"type":606,"tag":636,"props":1213,"children":1214},{"style":677},[1215],{"type":612,"value":775},{"type":606,"tag":636,"props":1217,"children":1218},{"style":671},[1219],{"type":612,"value":780},{"type":606,"tag":636,"props":1221,"children":1222},{"class":638,"line":126},[1223],{"type":606,"tag":636,"props":1224,"children":1225},{"style":642},[1226],{"type":612,"value":1227},"                # Process chunk here\n",{"type":606,"tag":636,"props":1229,"children":1230},{"class":638,"line":135},[1231,1236,1241],{"type":606,"tag":636,"props":1232,"children":1233},{"style":659},[1234],{"type":612,"value":1235},"    except",{"type":606,"tag":636,"props":1237,"children":1238},{"style":665},[1239],{"type":612,"value":1240}," FileNotFoundError",{"type":606,"tag":636,"props":1242,"children":1243},{"style":671},[1244],{"type":612,"value":711},{"type":606,"tag":636,"props":1246,"children":1247},{"class":638,"line":144},[1248,1253,1257,1261,1266,1271,1276,1280,1285],{"type":606,"tag":636,"props":1249,"children":1250},{"style":665},[1251],{"type":612,"value":1252},"        print",{"type":606,"tag":636,"props":1254,"children":1255},{"style":671},[1256],{"type":612,"value":674},{"type":606,"tag":636,"props":1258,"children":1259},{"style":659},[1260],{"type":612,"value":750},{"type":606,"tag":636,"props":1262,"children":1263},{"style":677},[1264],{"type":612,"value":1265},"\"File ",{"type":606,"tag":636,"props":1267,"children":1268},{"style":665},[1269],{"type":612,"value":1270},"{",{"type":606,"tag":636,"props":1272,"children":1273},{"style":671},[1274],{"type":612,"value":1275},"filename",{"type":606,"tag":636,"props":1277,"children":1278},{"style":665},[1279],{"type":612,"value":770},{"type":606,"tag":636,"props":1281,"children":1282},{"style":677},[1283],{"type":612,"value":1284}," not found\"",{"type":606,"tag":636,"props":1286,"children":1287},{"style":671},[1288],{"type":612,"value":780},{"type":606,"tag":636,"props":1290,"children":1291},{"class":638,"line":153},[1292],{"type":606,"tag":636,"props":1293,"children":1294},{"emptyLinePlaceholder":13},[1295],{"type":612,"value":788},{"type":606,"tag":636,"props":1297,"children":1298},{"class":638,"line":163},[1299],{"type":606,"tag":636,"props":1300,"children":1301},{"style":642},[1302],{"type":612,"value":1303},"# Example usage\n",{"type":606,"tag":636,"props":1305,"children":1306},{"class":638,"line":172},[1307,1312,1317],{"type":606,"tag":636,"props":1308,"children":1309},{"style":671},[1310],{"type":612,"value":1311},"read_binary_file(",{"type":606,"tag":636,"props":1313,"children":1314},{"style":677},[1315],{"type":612,"value":1316},"'example.bin'",{"type":606,"tag":636,"props":1318,"children":1319},{"style":671},[1320],{"type":612,"value":780},{"type":606,"tag":980,"props":1322,"children":1324},{"id":1323},"copying-binary-files",[1325],{"type":612,"value":1326},"Copying Binary Files",{"type":606,"tag":621,"props":1328,"children":1329},{},[1330],{"type":606,"tag":625,"props":1331,"children":1333},{"className":627,"code":1332,"language":629,"meta":8,"style":8},"# Copy binary file safely\ndef copy_binary_file(source, destination):\n    \"\"\"Copy binary file safely\"\"\"\n    try:\n        with open(source, 'rb') as src:\n            with open(destination, 'wb') as dst:\n                while True:\n                    chunk = src.read(8192)  # 8KB chunks\n                    if not chunk:\n                        break\n                    dst.write(chunk)\n        print(f\"Copied {source} to {destination}\")\n        return True\n    except Exception as e:\n        print(f\"Copy failed: {e}\")\n        return False\n\n# Example usage\nresult = copy_binary_file('input.jpg', 'output.jpg')\nprint(f\"Copy successful: {result}\")\n",[1334],{"type":606,"tag":632,"props":1335,"children":1336},{"__ignoreMap":8},[1337,1345,1362,1370,1381,1414,1448,1464,1496,1512,1520,1528,1588,1601,1623,1664,1676,1683,1690,1725],{"type":606,"tag":636,"props":1338,"children":1339},{"class":638,"line":12},[1340],{"type":606,"tag":636,"props":1341,"children":1342},{"style":642},[1343],{"type":612,"value":1344},"# Copy binary file safely\n",{"type":606,"tag":636,"props":1346,"children":1347},{"class":638,"line":27},[1348,1352,1357],{"type":606,"tag":636,"props":1349,"children":1350},{"style":659},[1351],{"type":612,"value":1031},{"type":606,"tag":636,"props":1353,"children":1354},{"style":1034},[1355],{"type":612,"value":1356}," copy_binary_file",{"type":606,"tag":636,"props":1358,"children":1359},{"style":671},[1360],{"type":612,"value":1361},"(source, destination):\n",{"type":606,"tag":636,"props":1363,"children":1364},{"class":638,"line":36},[1365],{"type":606,"tag":636,"props":1366,"children":1367},{"style":677},[1368],{"type":612,"value":1369},"    \"\"\"Copy binary file safely\"\"\"\n",{"type":606,"tag":636,"props":1371,"children":1372},{"class":638,"line":45},[1373,1377],{"type":606,"tag":636,"props":1374,"children":1375},{"style":659},[1376],{"type":612,"value":1072},{"type":606,"tag":636,"props":1378,"children":1379},{"style":671},[1380],{"type":612,"value":711},{"type":606,"tag":636,"props":1382,"children":1383},{"class":638,"line":54},[1384,1388,1392,1397,1401,1405,1409],{"type":606,"tag":636,"props":1385,"children":1386},{"style":659},[1387],{"type":612,"value":1084},{"type":606,"tag":636,"props":1389,"children":1390},{"style":665},[1391],{"type":612,"value":668},{"type":606,"tag":636,"props":1393,"children":1394},{"style":671},[1395],{"type":612,"value":1396},"(source, ",{"type":606,"tag":636,"props":1398,"children":1399},{"style":677},[1400],{"type":612,"value":690},{"type":606,"tag":636,"props":1402,"children":1403},{"style":671},[1404],{"type":612,"value":695},{"type":606,"tag":636,"props":1406,"children":1407},{"style":659},[1408],{"type":612,"value":700},{"type":606,"tag":636,"props":1410,"children":1411},{"style":671},[1412],{"type":612,"value":1413}," src:\n",{"type":606,"tag":636,"props":1415,"children":1416},{"class":638,"line":63},[1417,1422,1426,1431,1435,1439,1443],{"type":606,"tag":636,"props":1418,"children":1419},{"style":659},[1420],{"type":612,"value":1421},"            with",{"type":606,"tag":636,"props":1423,"children":1424},{"style":665},[1425],{"type":612,"value":668},{"type":606,"tag":636,"props":1427,"children":1428},{"style":671},[1429],{"type":612,"value":1430},"(destination, ",{"type":606,"tag":636,"props":1432,"children":1433},{"style":677},[1434],{"type":612,"value":825},{"type":606,"tag":636,"props":1436,"children":1437},{"style":671},[1438],{"type":612,"value":695},{"type":606,"tag":636,"props":1440,"children":1441},{"style":659},[1442],{"type":612,"value":700},{"type":606,"tag":636,"props":1444,"children":1445},{"style":671},[1446],{"type":612,"value":1447}," dst:\n",{"type":606,"tag":636,"props":1449,"children":1450},{"class":638,"line":72},[1451,1456,1460],{"type":606,"tag":636,"props":1452,"children":1453},{"style":659},[1454],{"type":612,"value":1455},"                while",{"type":606,"tag":636,"props":1457,"children":1458},{"style":665},[1459],{"type":612,"value":1126},{"type":606,"tag":636,"props":1461,"children":1462},{"style":671},[1463],{"type":612,"value":711},{"type":606,"tag":636,"props":1465,"children":1466},{"class":638,"line":81},[1467,1472,1476,1481,1486,1491],{"type":606,"tag":636,"props":1468,"children":1469},{"style":671},[1470],{"type":612,"value":1471},"                    chunk ",{"type":606,"tag":636,"props":1473,"children":1474},{"style":659},[1475],{"type":612,"value":724},{"type":606,"tag":636,"props":1477,"children":1478},{"style":671},[1479],{"type":612,"value":1480}," src.read(",{"type":606,"tag":636,"props":1482,"children":1483},{"style":665},[1484],{"type":612,"value":1485},"8192",{"type":606,"tag":636,"props":1487,"children":1488},{"style":671},[1489],{"type":612,"value":1490},")  ",{"type":606,"tag":636,"props":1492,"children":1493},{"style":642},[1494],{"type":612,"value":1495},"# 8KB chunks\n",{"type":606,"tag":636,"props":1497,"children":1498},{"class":638,"line":844},[1499,1504,1508],{"type":606,"tag":636,"props":1500,"children":1501},{"style":659},[1502],{"type":612,"value":1503},"                    if",{"type":606,"tag":636,"props":1505,"children":1506},{"style":659},[1507],{"type":612,"value":1164},{"type":606,"tag":636,"props":1509,"children":1510},{"style":671},[1511],{"type":612,"value":1169},{"type":606,"tag":636,"props":1513,"children":1514},{"class":638,"line":99},[1515],{"type":606,"tag":636,"props":1516,"children":1517},{"style":659},[1518],{"type":612,"value":1519},"                        break\n",{"type":606,"tag":636,"props":1521,"children":1522},{"class":638,"line":108},[1523],{"type":606,"tag":636,"props":1524,"children":1525},{"style":671},[1526],{"type":612,"value":1527},"                    dst.write(chunk)\n",{"type":606,"tag":636,"props":1529,"children":1530},{"class":638,"line":117},[1531,1535,1539,1543,1548,1552,1557,1561,1566,1570,1575,1579,1584],{"type":606,"tag":636,"props":1532,"children":1533},{"style":665},[1534],{"type":612,"value":1252},{"type":606,"tag":636,"props":1536,"children":1537},{"style":671},[1538],{"type":612,"value":674},{"type":606,"tag":636,"props":1540,"children":1541},{"style":659},[1542],{"type":612,"value":750},{"type":606,"tag":636,"props":1544,"children":1545},{"style":677},[1546],{"type":612,"value":1547},"\"Copied ",{"type":606,"tag":636,"props":1549,"children":1550},{"style":665},[1551],{"type":612,"value":1270},{"type":606,"tag":636,"props":1553,"children":1554},{"style":671},[1555],{"type":612,"value":1556},"source",{"type":606,"tag":636,"props":1558,"children":1559},{"style":665},[1560],{"type":612,"value":770},{"type":606,"tag":636,"props":1562,"children":1563},{"style":677},[1564],{"type":612,"value":1565}," to ",{"type":606,"tag":636,"props":1567,"children":1568},{"style":665},[1569],{"type":612,"value":1270},{"type":606,"tag":636,"props":1571,"children":1572},{"style":671},[1573],{"type":612,"value":1574},"destination",{"type":606,"tag":636,"props":1576,"children":1577},{"style":665},[1578],{"type":612,"value":770},{"type":606,"tag":636,"props":1580,"children":1581},{"style":677},[1582],{"type":612,"value":1583},"\"",{"type":606,"tag":636,"props":1585,"children":1586},{"style":671},[1587],{"type":612,"value":780},{"type":606,"tag":636,"props":1589,"children":1590},{"class":638,"line":126},[1591,1596],{"type":606,"tag":636,"props":1592,"children":1593},{"style":659},[1594],{"type":612,"value":1595},"        return",{"type":606,"tag":636,"props":1597,"children":1598},{"style":665},[1599],{"type":612,"value":1600}," True\n",{"type":606,"tag":636,"props":1602,"children":1603},{"class":638,"line":135},[1604,1608,1613,1618],{"type":606,"tag":636,"props":1605,"children":1606},{"style":659},[1607],{"type":612,"value":1235},{"type":606,"tag":636,"props":1609,"children":1610},{"style":665},[1611],{"type":612,"value":1612}," Exception",{"type":606,"tag":636,"props":1614,"children":1615},{"style":659},[1616],{"type":612,"value":1617}," as",{"type":606,"tag":636,"props":1619,"children":1620},{"style":671},[1621],{"type":612,"value":1622}," e:\n",{"type":606,"tag":636,"props":1624,"children":1625},{"class":638,"line":144},[1626,1630,1634,1638,1643,1647,1652,1656,1660],{"type":606,"tag":636,"props":1627,"children":1628},{"style":665},[1629],{"type":612,"value":1252},{"type":606,"tag":636,"props":1631,"children":1632},{"style":671},[1633],{"type":612,"value":674},{"type":606,"tag":636,"props":1635,"children":1636},{"style":659},[1637],{"type":612,"value":750},{"type":606,"tag":636,"props":1639,"children":1640},{"style":677},[1641],{"type":612,"value":1642},"\"Copy failed: ",{"type":606,"tag":636,"props":1644,"children":1645},{"style":665},[1646],{"type":612,"value":1270},{"type":606,"tag":636,"props":1648,"children":1649},{"style":671},[1650],{"type":612,"value":1651},"e",{"type":606,"tag":636,"props":1653,"children":1654},{"style":665},[1655],{"type":612,"value":770},{"type":606,"tag":636,"props":1657,"children":1658},{"style":677},[1659],{"type":612,"value":1583},{"type":606,"tag":636,"props":1661,"children":1662},{"style":671},[1663],{"type":612,"value":780},{"type":606,"tag":636,"props":1665,"children":1666},{"class":638,"line":153},[1667,1671],{"type":606,"tag":636,"props":1668,"children":1669},{"style":659},[1670],{"type":612,"value":1595},{"type":606,"tag":636,"props":1672,"children":1673},{"style":665},[1674],{"type":612,"value":1675}," False\n",{"type":606,"tag":636,"props":1677,"children":1678},{"class":638,"line":163},[1679],{"type":606,"tag":636,"props":1680,"children":1681},{"emptyLinePlaceholder":13},[1682],{"type":612,"value":788},{"type":606,"tag":636,"props":1684,"children":1685},{"class":638,"line":172},[1686],{"type":606,"tag":636,"props":1687,"children":1688},{"style":642},[1689],{"type":612,"value":1303},{"type":606,"tag":636,"props":1691,"children":1692},{"class":638,"line":181},[1693,1698,1702,1707,1712,1716,1721],{"type":606,"tag":636,"props":1694,"children":1695},{"style":671},[1696],{"type":612,"value":1697},"result ",{"type":606,"tag":636,"props":1699,"children":1700},{"style":659},[1701],{"type":612,"value":724},{"type":606,"tag":636,"props":1703,"children":1704},{"style":671},[1705],{"type":612,"value":1706}," copy_binary_file(",{"type":606,"tag":636,"props":1708,"children":1709},{"style":677},[1710],{"type":612,"value":1711},"'input.jpg'",{"type":606,"tag":636,"props":1713,"children":1714},{"style":671},[1715],{"type":612,"value":685},{"type":606,"tag":636,"props":1717,"children":1718},{"style":677},[1719],{"type":612,"value":1720},"'output.jpg'",{"type":606,"tag":636,"props":1722,"children":1723},{"style":671},[1724],{"type":612,"value":780},{"type":606,"tag":636,"props":1726,"children":1727},{"class":638,"line":190},[1728,1733,1737,1741,1746,1750,1755,1759,1763],{"type":606,"tag":636,"props":1729,"children":1730},{"style":665},[1731],{"type":612,"value":1732},"print",{"type":606,"tag":636,"props":1734,"children":1735},{"style":671},[1736],{"type":612,"value":674},{"type":606,"tag":636,"props":1738,"children":1739},{"style":659},[1740],{"type":612,"value":750},{"type":606,"tag":636,"props":1742,"children":1743},{"style":677},[1744],{"type":612,"value":1745},"\"Copy successful: ",{"type":606,"tag":636,"props":1747,"children":1748},{"style":665},[1749],{"type":612,"value":1270},{"type":606,"tag":636,"props":1751,"children":1752},{"style":671},[1753],{"type":612,"value":1754},"result",{"type":606,"tag":636,"props":1756,"children":1757},{"style":665},[1758],{"type":612,"value":770},{"type":606,"tag":636,"props":1760,"children":1761},{"style":677},[1762],{"type":612,"value":1583},{"type":606,"tag":636,"props":1764,"children":1765},{"style":671},[1766],{"type":612,"value":780},{"type":606,"tag":980,"props":1768,"children":1770},{"id":1769},"structured-binary-data",[1771],{"type":612,"value":1772},"Structured Binary Data",{"type":606,"tag":621,"props":1774,"children":1775},{},[1776],{"type":606,"tag":625,"props":1777,"children":1779},{"className":627,"code":1778,"language":629,"meta":8,"style":8},"import struct\n\n# Working with structured binary data\ndef write_binary_data():\n    \"\"\"Write structured binary data\"\"\"\n    # Pack data into binary format\n    # Format: i = integer, f = float, 10s = 10-character string\n    data = struct.pack('if10s', 42, 3.14, b'Hello')\n    \n    with open('data.bin', 'wb') as file:\n        file.write(data)\n    \n    print(f\"Written {len(data)} bytes\")\n\ndef read_binary_data():\n    \"\"\"Read structured binary data\"\"\"\n    try:\n        with open('data.bin', 'rb') as file:\n            data = file.read()\n            # Unpack binary data\n            integer, float_val, string_val = struct.unpack('if10s', data)\n            print(f\"Integer: {integer}\")\n            print(f\"Float: {float_val}\")\n            print(f\"String: {string_val.strip(b'\\\\x00').decode()}\")\n    except FileNotFoundError:\n        print(\"Binary data file not found\")\n\nwrite_binary_data()\nread_binary_data()\n",[1780],{"type":606,"tag":632,"props":1781,"children":1782},{"__ignoreMap":8},[1783,1795,1802,1810,1827,1835,1843,1851,1908,1916,1961,1973,1980,2020,2027,2043,2051,2062,2105,2125,2133,2159,2201,2242,2307,2322,2342,2349,2357],{"type":606,"tag":636,"props":1784,"children":1785},{"class":638,"line":12},[1786,1790],{"type":606,"tag":636,"props":1787,"children":1788},{"style":659},[1789],{"type":612,"value":1003},{"type":606,"tag":636,"props":1791,"children":1792},{"style":671},[1793],{"type":612,"value":1794}," struct\n",{"type":606,"tag":636,"props":1796,"children":1797},{"class":638,"line":27},[1798],{"type":606,"tag":636,"props":1799,"children":1800},{"emptyLinePlaceholder":13},[1801],{"type":612,"value":788},{"type":606,"tag":636,"props":1803,"children":1804},{"class":638,"line":36},[1805],{"type":606,"tag":636,"props":1806,"children":1807},{"style":642},[1808],{"type":612,"value":1809},"# Working with structured binary data\n",{"type":606,"tag":636,"props":1811,"children":1812},{"class":638,"line":45},[1813,1817,1822],{"type":606,"tag":636,"props":1814,"children":1815},{"style":659},[1816],{"type":612,"value":1031},{"type":606,"tag":636,"props":1818,"children":1819},{"style":1034},[1820],{"type":612,"value":1821}," write_binary_data",{"type":606,"tag":636,"props":1823,"children":1824},{"style":671},[1825],{"type":612,"value":1826},"():\n",{"type":606,"tag":636,"props":1828,"children":1829},{"class":638,"line":54},[1830],{"type":606,"tag":636,"props":1831,"children":1832},{"style":677},[1833],{"type":612,"value":1834},"    \"\"\"Write structured binary data\"\"\"\n",{"type":606,"tag":636,"props":1836,"children":1837},{"class":638,"line":63},[1838],{"type":606,"tag":636,"props":1839,"children":1840},{"style":642},[1841],{"type":612,"value":1842},"    # Pack data into binary format\n",{"type":606,"tag":636,"props":1844,"children":1845},{"class":638,"line":72},[1846],{"type":606,"tag":636,"props":1847,"children":1848},{"style":642},[1849],{"type":612,"value":1850},"    # Format: i = integer, f = float, 10s = 10-character string\n",{"type":606,"tag":636,"props":1852,"children":1853},{"class":638,"line":81},[1854,1858,1862,1867,1872,1876,1881,1885,1890,1894,1899,1904],{"type":606,"tag":636,"props":1855,"children":1856},{"style":671},[1857],{"type":612,"value":719},{"type":606,"tag":636,"props":1859,"children":1860},{"style":659},[1861],{"type":612,"value":724},{"type":606,"tag":636,"props":1863,"children":1864},{"style":671},[1865],{"type":612,"value":1866}," struct.pack(",{"type":606,"tag":636,"props":1868,"children":1869},{"style":677},[1870],{"type":612,"value":1871},"'if10s'",{"type":606,"tag":636,"props":1873,"children":1874},{"style":671},[1875],{"type":612,"value":685},{"type":606,"tag":636,"props":1877,"children":1878},{"style":665},[1879],{"type":612,"value":1880},"42",{"type":606,"tag":636,"props":1882,"children":1883},{"style":671},[1884],{"type":612,"value":685},{"type":606,"tag":636,"props":1886,"children":1887},{"style":665},[1888],{"type":612,"value":1889},"3.14",{"type":606,"tag":636,"props":1891,"children":1892},{"style":671},[1893],{"type":612,"value":685},{"type":606,"tag":636,"props":1895,"children":1896},{"style":659},[1897],{"type":612,"value":1898},"b",{"type":606,"tag":636,"props":1900,"children":1901},{"style":677},[1902],{"type":612,"value":1903},"'Hello'",{"type":606,"tag":636,"props":1905,"children":1906},{"style":671},[1907],{"type":612,"value":780},{"type":606,"tag":636,"props":1909,"children":1910},{"class":638,"line":844},[1911],{"type":606,"tag":636,"props":1912,"children":1913},{"style":671},[1914],{"type":612,"value":1915},"    \n",{"type":606,"tag":636,"props":1917,"children":1918},{"class":638,"line":99},[1919,1924,1928,1932,1937,1941,1945,1949,1953,1957],{"type":606,"tag":636,"props":1920,"children":1921},{"style":659},[1922],{"type":612,"value":1923},"    with",{"type":606,"tag":636,"props":1925,"children":1926},{"style":665},[1927],{"type":612,"value":668},{"type":606,"tag":636,"props":1929,"children":1930},{"style":671},[1931],{"type":612,"value":674},{"type":606,"tag":636,"props":1933,"children":1934},{"style":677},[1935],{"type":612,"value":1936},"'data.bin'",{"type":606,"tag":636,"props":1938,"children":1939},{"style":671},[1940],{"type":612,"value":685},{"type":606,"tag":636,"props":1942,"children":1943},{"style":677},[1944],{"type":612,"value":825},{"type":606,"tag":636,"props":1946,"children":1947},{"style":671},[1948],{"type":612,"value":695},{"type":606,"tag":636,"props":1950,"children":1951},{"style":659},[1952],{"type":612,"value":700},{"type":606,"tag":636,"props":1954,"children":1955},{"style":703},[1956],{"type":612,"value":706},{"type":606,"tag":636,"props":1958,"children":1959},{"style":671},[1960],{"type":612,"value":711},{"type":606,"tag":636,"props":1962,"children":1963},{"class":638,"line":108},[1964,1969],{"type":606,"tag":636,"props":1965,"children":1966},{"style":703},[1967],{"type":612,"value":1968},"        file",{"type":606,"tag":636,"props":1970,"children":1971},{"style":671},[1972],{"type":612,"value":855},{"type":606,"tag":636,"props":1974,"children":1975},{"class":638,"line":117},[1976],{"type":606,"tag":636,"props":1977,"children":1978},{"style":671},[1979],{"type":612,"value":1915},{"type":606,"tag":636,"props":1981,"children":1982},{"class":638,"line":126},[1983,1987,1991,1995,2000,2004,2008,2012,2016],{"type":606,"tag":636,"props":1984,"children":1985},{"style":665},[1986],{"type":612,"value":741},{"type":606,"tag":636,"props":1988,"children":1989},{"style":671},[1990],{"type":612,"value":674},{"type":606,"tag":636,"props":1992,"children":1993},{"style":659},[1994],{"type":612,"value":750},{"type":606,"tag":636,"props":1996,"children":1997},{"style":677},[1998],{"type":612,"value":1999},"\"Written ",{"type":606,"tag":636,"props":2001,"children":2002},{"style":665},[2003],{"type":612,"value":760},{"type":606,"tag":636,"props":2005,"children":2006},{"style":671},[2007],{"type":612,"value":765},{"type":606,"tag":636,"props":2009,"children":2010},{"style":665},[2011],{"type":612,"value":770},{"type":606,"tag":636,"props":2013,"children":2014},{"style":677},[2015],{"type":612,"value":775},{"type":606,"tag":636,"props":2017,"children":2018},{"style":671},[2019],{"type":612,"value":780},{"type":606,"tag":636,"props":2021,"children":2022},{"class":638,"line":135},[2023],{"type":606,"tag":636,"props":2024,"children":2025},{"emptyLinePlaceholder":13},[2026],{"type":612,"value":788},{"type":606,"tag":636,"props":2028,"children":2029},{"class":638,"line":144},[2030,2034,2039],{"type":606,"tag":636,"props":2031,"children":2032},{"style":659},[2033],{"type":612,"value":1031},{"type":606,"tag":636,"props":2035,"children":2036},{"style":1034},[2037],{"type":612,"value":2038}," read_binary_data",{"type":606,"tag":636,"props":2040,"children":2041},{"style":671},[2042],{"type":612,"value":1826},{"type":606,"tag":636,"props":2044,"children":2045},{"class":638,"line":153},[2046],{"type":606,"tag":636,"props":2047,"children":2048},{"style":677},[2049],{"type":612,"value":2050},"    \"\"\"Read structured binary data\"\"\"\n",{"type":606,"tag":636,"props":2052,"children":2053},{"class":638,"line":163},[2054,2058],{"type":606,"tag":636,"props":2055,"children":2056},{"style":659},[2057],{"type":612,"value":1072},{"type":606,"tag":636,"props":2059,"children":2060},{"style":671},[2061],{"type":612,"value":711},{"type":606,"tag":636,"props":2063,"children":2064},{"class":638,"line":172},[2065,2069,2073,2077,2081,2085,2089,2093,2097,2101],{"type":606,"tag":636,"props":2066,"children":2067},{"style":659},[2068],{"type":612,"value":1084},{"type":606,"tag":636,"props":2070,"children":2071},{"style":665},[2072],{"type":612,"value":668},{"type":606,"tag":636,"props":2074,"children":2075},{"style":671},[2076],{"type":612,"value":674},{"type":606,"tag":636,"props":2078,"children":2079},{"style":677},[2080],{"type":612,"value":1936},{"type":606,"tag":636,"props":2082,"children":2083},{"style":671},[2084],{"type":612,"value":685},{"type":606,"tag":636,"props":2086,"children":2087},{"style":677},[2088],{"type":612,"value":690},{"type":606,"tag":636,"props":2090,"children":2091},{"style":671},[2092],{"type":612,"value":695},{"type":606,"tag":636,"props":2094,"children":2095},{"style":659},[2096],{"type":612,"value":700},{"type":606,"tag":636,"props":2098,"children":2099},{"style":703},[2100],{"type":612,"value":706},{"type":606,"tag":636,"props":2102,"children":2103},{"style":671},[2104],{"type":612,"value":711},{"type":606,"tag":636,"props":2106,"children":2107},{"class":638,"line":181},[2108,2113,2117,2121],{"type":606,"tag":636,"props":2109,"children":2110},{"style":671},[2111],{"type":612,"value":2112},"            data ",{"type":606,"tag":636,"props":2114,"children":2115},{"style":659},[2116],{"type":612,"value":724},{"type":606,"tag":636,"props":2118,"children":2119},{"style":703},[2120],{"type":612,"value":706},{"type":606,"tag":636,"props":2122,"children":2123},{"style":671},[2124],{"type":612,"value":733},{"type":606,"tag":636,"props":2126,"children":2127},{"class":638,"line":190},[2128],{"type":606,"tag":636,"props":2129,"children":2130},{"style":642},[2131],{"type":612,"value":2132},"            # Unpack binary data\n",{"type":606,"tag":636,"props":2134,"children":2135},{"class":638,"line":199},[2136,2141,2145,2150,2154],{"type":606,"tag":636,"props":2137,"children":2138},{"style":671},[2139],{"type":612,"value":2140},"            integer, float_val, string_val ",{"type":606,"tag":636,"props":2142,"children":2143},{"style":659},[2144],{"type":612,"value":724},{"type":606,"tag":636,"props":2146,"children":2147},{"style":671},[2148],{"type":612,"value":2149}," struct.unpack(",{"type":606,"tag":636,"props":2151,"children":2152},{"style":677},[2153],{"type":612,"value":1871},{"type":606,"tag":636,"props":2155,"children":2156},{"style":671},[2157],{"type":612,"value":2158},", data)\n",{"type":606,"tag":636,"props":2160,"children":2161},{"class":638,"line":208},[2162,2167,2171,2175,2180,2184,2189,2193,2197],{"type":606,"tag":636,"props":2163,"children":2164},{"style":665},[2165],{"type":612,"value":2166},"            print",{"type":606,"tag":636,"props":2168,"children":2169},{"style":671},[2170],{"type":612,"value":674},{"type":606,"tag":636,"props":2172,"children":2173},{"style":659},[2174],{"type":612,"value":750},{"type":606,"tag":636,"props":2176,"children":2177},{"style":677},[2178],{"type":612,"value":2179},"\"Integer: ",{"type":606,"tag":636,"props":2181,"children":2182},{"style":665},[2183],{"type":612,"value":1270},{"type":606,"tag":636,"props":2185,"children":2186},{"style":671},[2187],{"type":612,"value":2188},"integer",{"type":606,"tag":636,"props":2190,"children":2191},{"style":665},[2192],{"type":612,"value":770},{"type":606,"tag":636,"props":2194,"children":2195},{"style":677},[2196],{"type":612,"value":1583},{"type":606,"tag":636,"props":2198,"children":2199},{"style":671},[2200],{"type":612,"value":780},{"type":606,"tag":636,"props":2202,"children":2203},{"class":638,"line":217},[2204,2208,2212,2216,2221,2225,2230,2234,2238],{"type":606,"tag":636,"props":2205,"children":2206},{"style":665},[2207],{"type":612,"value":2166},{"type":606,"tag":636,"props":2209,"children":2210},{"style":671},[2211],{"type":612,"value":674},{"type":606,"tag":636,"props":2213,"children":2214},{"style":659},[2215],{"type":612,"value":750},{"type":606,"tag":636,"props":2217,"children":2218},{"style":677},[2219],{"type":612,"value":2220},"\"Float: ",{"type":606,"tag":636,"props":2222,"children":2223},{"style":665},[2224],{"type":612,"value":1270},{"type":606,"tag":636,"props":2226,"children":2227},{"style":671},[2228],{"type":612,"value":2229},"float_val",{"type":606,"tag":636,"props":2231,"children":2232},{"style":665},[2233],{"type":612,"value":770},{"type":606,"tag":636,"props":2235,"children":2236},{"style":677},[2237],{"type":612,"value":1583},{"type":606,"tag":636,"props":2239,"children":2240},{"style":671},[2241],{"type":612,"value":780},{"type":606,"tag":636,"props":2243,"children":2244},{"class":638,"line":227},[2245,2249,2253,2257,2262,2266,2271,2275,2280,2285,2290,2295,2299,2303],{"type":606,"tag":636,"props":2246,"children":2247},{"style":665},[2248],{"type":612,"value":2166},{"type":606,"tag":636,"props":2250,"children":2251},{"style":671},[2252],{"type":612,"value":674},{"type":606,"tag":636,"props":2254,"children":2255},{"style":659},[2256],{"type":612,"value":750},{"type":606,"tag":636,"props":2258,"children":2259},{"style":677},[2260],{"type":612,"value":2261},"\"String: ",{"type":606,"tag":636,"props":2263,"children":2264},{"style":665},[2265],{"type":612,"value":1270},{"type":606,"tag":636,"props":2267,"children":2268},{"style":671},[2269],{"type":612,"value":2270},"string_val.strip(",{"type":606,"tag":636,"props":2272,"children":2273},{"style":659},[2274],{"type":612,"value":1898},{"type":606,"tag":636,"props":2276,"children":2277},{"style":677},[2278],{"type":612,"value":2279},"'",{"type":606,"tag":636,"props":2281,"children":2282},{"style":665},[2283],{"type":612,"value":2284},"\\\\",{"type":606,"tag":636,"props":2286,"children":2287},{"style":677},[2288],{"type":612,"value":2289},"x00'",{"type":606,"tag":636,"props":2291,"children":2292},{"style":671},[2293],{"type":612,"value":2294},").decode()",{"type":606,"tag":636,"props":2296,"children":2297},{"style":665},[2298],{"type":612,"value":770},{"type":606,"tag":636,"props":2300,"children":2301},{"style":677},[2302],{"type":612,"value":1583},{"type":606,"tag":636,"props":2304,"children":2305},{"style":671},[2306],{"type":612,"value":780},{"type":606,"tag":636,"props":2308,"children":2309},{"class":638,"line":236},[2310,2314,2318],{"type":606,"tag":636,"props":2311,"children":2312},{"style":659},[2313],{"type":612,"value":1235},{"type":606,"tag":636,"props":2315,"children":2316},{"style":665},[2317],{"type":612,"value":1240},{"type":606,"tag":636,"props":2319,"children":2320},{"style":671},[2321],{"type":612,"value":711},{"type":606,"tag":636,"props":2323,"children":2324},{"class":638,"line":245},[2325,2329,2333,2338],{"type":606,"tag":636,"props":2326,"children":2327},{"style":665},[2328],{"type":612,"value":1252},{"type":606,"tag":636,"props":2330,"children":2331},{"style":671},[2332],{"type":612,"value":674},{"type":606,"tag":636,"props":2334,"children":2335},{"style":677},[2336],{"type":612,"value":2337},"\"Binary data file not found\"",{"type":606,"tag":636,"props":2339,"children":2340},{"style":671},[2341],{"type":612,"value":780},{"type":606,"tag":636,"props":2343,"children":2344},{"class":638,"line":254},[2345],{"type":606,"tag":636,"props":2346,"children":2347},{"emptyLinePlaceholder":13},[2348],{"type":612,"value":788},{"type":606,"tag":636,"props":2350,"children":2351},{"class":638,"line":263},[2352],{"type":606,"tag":636,"props":2353,"children":2354},{"style":671},[2355],{"type":612,"value":2356},"write_binary_data()\n",{"type":606,"tag":636,"props":2358,"children":2359},{"class":638,"line":272},[2360],{"type":606,"tag":636,"props":2361,"children":2362},{"style":671},[2363],{"type":612,"value":2364},"read_binary_data()\n",{"type":606,"tag":980,"props":2366,"children":2368},{"id":2367},"file-information",[2369],{"type":612,"value":2370},"File Information",{"type":606,"tag":621,"props":2372,"children":2373},{},[2374],{"type":606,"tag":625,"props":2375,"children":2377},{"className":627,"code":2376,"language":629,"meta":8,"style":8},"# File size and metadata\ndef get_file_info(filename):\n    \"\"\"Get binary file information\"\"\"\n    try:\n        stat = os.stat(filename)\n        return {\n            'size': stat.st_size,\n            'created': stat.st_ctime,\n            'modified': stat.st_mtime,\n            'readable': os.access(filename, os.R_OK),\n            'writable': os.access(filename, os.W_OK)\n        }\n    except Exception as e:\n        print(f\"Error getting file info: {e}\")\n        return None\n\ninfo = get_file_info('data.bin')\nif info:\n    print(f\"File size: {info['size']} bytes\")\n    print(f\"Readable: {info['readable']}\")\n",[2378],{"type":606,"tag":632,"props":2379,"children":2380},{"__ignoreMap":8},[2381,2389,2406,2414,2425,2442,2454,2467,2480,2493,2516,2537,2545,2564,2604,2616,2623,2648,2661,2711],{"type":606,"tag":636,"props":2382,"children":2383},{"class":638,"line":12},[2384],{"type":606,"tag":636,"props":2385,"children":2386},{"style":642},[2387],{"type":612,"value":2388},"# File size and metadata\n",{"type":606,"tag":636,"props":2390,"children":2391},{"class":638,"line":27},[2392,2396,2401],{"type":606,"tag":636,"props":2393,"children":2394},{"style":659},[2395],{"type":612,"value":1031},{"type":606,"tag":636,"props":2397,"children":2398},{"style":1034},[2399],{"type":612,"value":2400}," get_file_info",{"type":606,"tag":636,"props":2402,"children":2403},{"style":671},[2404],{"type":612,"value":2405},"(filename):\n",{"type":606,"tag":636,"props":2407,"children":2408},{"class":638,"line":36},[2409],{"type":606,"tag":636,"props":2410,"children":2411},{"style":677},[2412],{"type":612,"value":2413},"    \"\"\"Get binary file information\"\"\"\n",{"type":606,"tag":636,"props":2415,"children":2416},{"class":638,"line":45},[2417,2421],{"type":606,"tag":636,"props":2418,"children":2419},{"style":659},[2420],{"type":612,"value":1072},{"type":606,"tag":636,"props":2422,"children":2423},{"style":671},[2424],{"type":612,"value":711},{"type":606,"tag":636,"props":2426,"children":2427},{"class":638,"line":54},[2428,2433,2437],{"type":606,"tag":636,"props":2429,"children":2430},{"style":671},[2431],{"type":612,"value":2432},"        stat ",{"type":606,"tag":636,"props":2434,"children":2435},{"style":659},[2436],{"type":612,"value":724},{"type":606,"tag":636,"props":2438,"children":2439},{"style":671},[2440],{"type":612,"value":2441}," os.stat(filename)\n",{"type":606,"tag":636,"props":2443,"children":2444},{"class":638,"line":63},[2445,2449],{"type":606,"tag":636,"props":2446,"children":2447},{"style":659},[2448],{"type":612,"value":1595},{"type":606,"tag":636,"props":2450,"children":2451},{"style":671},[2452],{"type":612,"value":2453}," {\n",{"type":606,"tag":636,"props":2455,"children":2456},{"class":638,"line":72},[2457,2462],{"type":606,"tag":636,"props":2458,"children":2459},{"style":677},[2460],{"type":612,"value":2461},"            'size'",{"type":606,"tag":636,"props":2463,"children":2464},{"style":671},[2465],{"type":612,"value":2466},": stat.st_size,\n",{"type":606,"tag":636,"props":2468,"children":2469},{"class":638,"line":81},[2470,2475],{"type":606,"tag":636,"props":2471,"children":2472},{"style":677},[2473],{"type":612,"value":2474},"            'created'",{"type":606,"tag":636,"props":2476,"children":2477},{"style":671},[2478],{"type":612,"value":2479},": stat.st_ctime,\n",{"type":606,"tag":636,"props":2481,"children":2482},{"class":638,"line":844},[2483,2488],{"type":606,"tag":636,"props":2484,"children":2485},{"style":677},[2486],{"type":612,"value":2487},"            'modified'",{"type":606,"tag":636,"props":2489,"children":2490},{"style":671},[2491],{"type":612,"value":2492},": stat.st_mtime,\n",{"type":606,"tag":636,"props":2494,"children":2495},{"class":638,"line":99},[2496,2501,2506,2511],{"type":606,"tag":636,"props":2497,"children":2498},{"style":677},[2499],{"type":612,"value":2500},"            'readable'",{"type":606,"tag":636,"props":2502,"children":2503},{"style":671},[2504],{"type":612,"value":2505},": os.access(filename, os.",{"type":606,"tag":636,"props":2507,"children":2508},{"style":665},[2509],{"type":612,"value":2510},"R_OK",{"type":606,"tag":636,"props":2512,"children":2513},{"style":671},[2514],{"type":612,"value":2515},"),\n",{"type":606,"tag":636,"props":2517,"children":2518},{"class":638,"line":108},[2519,2524,2528,2533],{"type":606,"tag":636,"props":2520,"children":2521},{"style":677},[2522],{"type":612,"value":2523},"            'writable'",{"type":606,"tag":636,"props":2525,"children":2526},{"style":671},[2527],{"type":612,"value":2505},{"type":606,"tag":636,"props":2529,"children":2530},{"style":665},[2531],{"type":612,"value":2532},"W_OK",{"type":606,"tag":636,"props":2534,"children":2535},{"style":671},[2536],{"type":612,"value":780},{"type":606,"tag":636,"props":2538,"children":2539},{"class":638,"line":117},[2540],{"type":606,"tag":636,"props":2541,"children":2542},{"style":671},[2543],{"type":612,"value":2544},"        }\n",{"type":606,"tag":636,"props":2546,"children":2547},{"class":638,"line":126},[2548,2552,2556,2560],{"type":606,"tag":636,"props":2549,"children":2550},{"style":659},[2551],{"type":612,"value":1235},{"type":606,"tag":636,"props":2553,"children":2554},{"style":665},[2555],{"type":612,"value":1612},{"type":606,"tag":636,"props":2557,"children":2558},{"style":659},[2559],{"type":612,"value":1617},{"type":606,"tag":636,"props":2561,"children":2562},{"style":671},[2563],{"type":612,"value":1622},{"type":606,"tag":636,"props":2565,"children":2566},{"class":638,"line":135},[2567,2571,2575,2579,2584,2588,2592,2596,2600],{"type":606,"tag":636,"props":2568,"children":2569},{"style":665},[2570],{"type":612,"value":1252},{"type":606,"tag":636,"props":2572,"children":2573},{"style":671},[2574],{"type":612,"value":674},{"type":606,"tag":636,"props":2576,"children":2577},{"style":659},[2578],{"type":612,"value":750},{"type":606,"tag":636,"props":2580,"children":2581},{"style":677},[2582],{"type":612,"value":2583},"\"Error getting file info: ",{"type":606,"tag":636,"props":2585,"children":2586},{"style":665},[2587],{"type":612,"value":1270},{"type":606,"tag":636,"props":2589,"children":2590},{"style":671},[2591],{"type":612,"value":1651},{"type":606,"tag":636,"props":2593,"children":2594},{"style":665},[2595],{"type":612,"value":770},{"type":606,"tag":636,"props":2597,"children":2598},{"style":677},[2599],{"type":612,"value":1583},{"type":606,"tag":636,"props":2601,"children":2602},{"style":671},[2603],{"type":612,"value":780},{"type":606,"tag":636,"props":2605,"children":2606},{"class":638,"line":144},[2607,2611],{"type":606,"tag":636,"props":2608,"children":2609},{"style":659},[2610],{"type":612,"value":1595},{"type":606,"tag":636,"props":2612,"children":2613},{"style":665},[2614],{"type":612,"value":2615}," None\n",{"type":606,"tag":636,"props":2617,"children":2618},{"class":638,"line":153},[2619],{"type":606,"tag":636,"props":2620,"children":2621},{"emptyLinePlaceholder":13},[2622],{"type":612,"value":788},{"type":606,"tag":636,"props":2624,"children":2625},{"class":638,"line":163},[2626,2631,2635,2640,2644],{"type":606,"tag":636,"props":2627,"children":2628},{"style":671},[2629],{"type":612,"value":2630},"info ",{"type":606,"tag":636,"props":2632,"children":2633},{"style":659},[2634],{"type":612,"value":724},{"type":606,"tag":636,"props":2636,"children":2637},{"style":671},[2638],{"type":612,"value":2639}," get_file_info(",{"type":606,"tag":636,"props":2641,"children":2642},{"style":677},[2643],{"type":612,"value":1936},{"type":606,"tag":636,"props":2645,"children":2646},{"style":671},[2647],{"type":612,"value":780},{"type":606,"tag":636,"props":2649,"children":2650},{"class":638,"line":172},[2651,2656],{"type":606,"tag":636,"props":2652,"children":2653},{"style":659},[2654],{"type":612,"value":2655},"if",{"type":606,"tag":636,"props":2657,"children":2658},{"style":671},[2659],{"type":612,"value":2660}," info:\n",{"type":606,"tag":636,"props":2662,"children":2663},{"class":638,"line":181},[2664,2668,2672,2676,2680,2684,2689,2694,2699,2703,2707],{"type":606,"tag":636,"props":2665,"children":2666},{"style":665},[2667],{"type":612,"value":741},{"type":606,"tag":636,"props":2669,"children":2670},{"style":671},[2671],{"type":612,"value":674},{"type":606,"tag":636,"props":2673,"children":2674},{"style":659},[2675],{"type":612,"value":750},{"type":606,"tag":636,"props":2677,"children":2678},{"style":677},[2679],{"type":612,"value":755},{"type":606,"tag":636,"props":2681,"children":2682},{"style":665},[2683],{"type":612,"value":1270},{"type":606,"tag":636,"props":2685,"children":2686},{"style":671},[2687],{"type":612,"value":2688},"info[",{"type":606,"tag":636,"props":2690,"children":2691},{"style":677},[2692],{"type":612,"value":2693},"'size'",{"type":606,"tag":636,"props":2695,"children":2696},{"style":671},[2697],{"type":612,"value":2698},"]",{"type":606,"tag":636,"props":2700,"children":2701},{"style":665},[2702],{"type":612,"value":770},{"type":606,"tag":636,"props":2704,"children":2705},{"style":677},[2706],{"type":612,"value":775},{"type":606,"tag":636,"props":2708,"children":2709},{"style":671},[2710],{"type":612,"value":780},{"type":606,"tag":636,"props":2712,"children":2713},{"class":638,"line":190},[2714,2718,2722,2726,2731,2735,2739,2744,2748,2752,2756],{"type":606,"tag":636,"props":2715,"children":2716},{"style":665},[2717],{"type":612,"value":741},{"type":606,"tag":636,"props":2719,"children":2720},{"style":671},[2721],{"type":612,"value":674},{"type":606,"tag":636,"props":2723,"children":2724},{"style":659},[2725],{"type":612,"value":750},{"type":606,"tag":636,"props":2727,"children":2728},{"style":677},[2729],{"type":612,"value":2730},"\"Readable: ",{"type":606,"tag":636,"props":2732,"children":2733},{"style":665},[2734],{"type":612,"value":1270},{"type":606,"tag":636,"props":2736,"children":2737},{"style":671},[2738],{"type":612,"value":2688},{"type":606,"tag":636,"props":2740,"children":2741},{"style":677},[2742],{"type":612,"value":2743},"'readable'",{"type":606,"tag":636,"props":2745,"children":2746},{"style":671},[2747],{"type":612,"value":2698},{"type":606,"tag":636,"props":2749,"children":2750},{"style":665},[2751],{"type":612,"value":770},{"type":606,"tag":636,"props":2753,"children":2754},{"style":677},[2755],{"type":612,"value":1583},{"type":606,"tag":636,"props":2757,"children":2758},{"style":671},[2759],{"type":612,"value":780},{"type":606,"tag":857,"props":2761,"children":2763},{"id":2762},"advanced-binary-operations",[2764],{"type":612,"value":2765},"🔍 Advanced Binary Operations",{"type":606,"tag":615,"props":2767,"children":2768},{},[2769],{"type":612,"value":2770},"Python allows sophisticated binary file manipulation.",{"type":606,"tag":980,"props":2772,"children":2774},{"id":2773},"file-integrity-checking",[2775],{"type":612,"value":2776},"File Integrity Checking",{"type":606,"tag":621,"props":2778,"children":2779},{},[2780],{"type":606,"tag":625,"props":2781,"children":2783},{"className":627,"code":2782,"language":629,"meta":8,"style":8},"import hashlib\n\n# File integrity checking\ndef calculate_checksum(filename, algorithm='md5'):\n    \"\"\"Calculate file checksum for integrity\"\"\"\n    try:\n        hash_func = hashlib.new(algorithm)\n        \n        with open(filename, 'rb') as file:\n            while True:\n                chunk = file.read(8192)\n                if not chunk:\n                    break\n                hash_func.update(chunk)\n        \n        return hash_func.hexdigest()\n    except FileNotFoundError:\n        return None\n\n# Example checksum calculation\nchecksum = calculate_checksum('data.bin')\nif checksum:\n    print(f\"MD5 checksum: {checksum}\")\n",[2784],{"type":606,"tag":632,"props":2785,"children":2786},{"__ignoreMap":8},[2787,2799,2806,2814,2844,2852,2863,2880,2888,2923,2938,2966,2981,2988,2996,3003,3015,3030,3041,3048,3056,3081,3093],{"type":606,"tag":636,"props":2788,"children":2789},{"class":638,"line":12},[2790,2794],{"type":606,"tag":636,"props":2791,"children":2792},{"style":659},[2793],{"type":612,"value":1003},{"type":606,"tag":636,"props":2795,"children":2796},{"style":671},[2797],{"type":612,"value":2798}," hashlib\n",{"type":606,"tag":636,"props":2800,"children":2801},{"class":638,"line":27},[2802],{"type":606,"tag":636,"props":2803,"children":2804},{"emptyLinePlaceholder":13},[2805],{"type":612,"value":788},{"type":606,"tag":636,"props":2807,"children":2808},{"class":638,"line":36},[2809],{"type":606,"tag":636,"props":2810,"children":2811},{"style":642},[2812],{"type":612,"value":2813},"# File integrity checking\n",{"type":606,"tag":636,"props":2815,"children":2816},{"class":638,"line":45},[2817,2821,2826,2831,2835,2840],{"type":606,"tag":636,"props":2818,"children":2819},{"style":659},[2820],{"type":612,"value":1031},{"type":606,"tag":636,"props":2822,"children":2823},{"style":1034},[2824],{"type":612,"value":2825}," calculate_checksum",{"type":606,"tag":636,"props":2827,"children":2828},{"style":671},[2829],{"type":612,"value":2830},"(filename, algorithm",{"type":606,"tag":636,"props":2832,"children":2833},{"style":659},[2834],{"type":612,"value":724},{"type":606,"tag":636,"props":2836,"children":2837},{"style":677},[2838],{"type":612,"value":2839},"'md5'",{"type":606,"tag":636,"props":2841,"children":2842},{"style":671},[2843],{"type":612,"value":1056},{"type":606,"tag":636,"props":2845,"children":2846},{"class":638,"line":54},[2847],{"type":606,"tag":636,"props":2848,"children":2849},{"style":677},[2850],{"type":612,"value":2851},"    \"\"\"Calculate file checksum for integrity\"\"\"\n",{"type":606,"tag":636,"props":2853,"children":2854},{"class":638,"line":63},[2855,2859],{"type":606,"tag":636,"props":2856,"children":2857},{"style":659},[2858],{"type":612,"value":1072},{"type":606,"tag":636,"props":2860,"children":2861},{"style":671},[2862],{"type":612,"value":711},{"type":606,"tag":636,"props":2864,"children":2865},{"class":638,"line":72},[2866,2871,2875],{"type":606,"tag":636,"props":2867,"children":2868},{"style":671},[2869],{"type":612,"value":2870},"        hash_func ",{"type":606,"tag":636,"props":2872,"children":2873},{"style":659},[2874],{"type":612,"value":724},{"type":606,"tag":636,"props":2876,"children":2877},{"style":671},[2878],{"type":612,"value":2879}," hashlib.new(algorithm)\n",{"type":606,"tag":636,"props":2881,"children":2882},{"class":638,"line":81},[2883],{"type":606,"tag":636,"props":2884,"children":2885},{"style":671},[2886],{"type":612,"value":2887},"        \n",{"type":606,"tag":636,"props":2889,"children":2890},{"class":638,"line":844},[2891,2895,2899,2903,2907,2911,2915,2919],{"type":606,"tag":636,"props":2892,"children":2893},{"style":659},[2894],{"type":612,"value":1084},{"type":606,"tag":636,"props":2896,"children":2897},{"style":665},[2898],{"type":612,"value":668},{"type":606,"tag":636,"props":2900,"children":2901},{"style":671},[2902],{"type":612,"value":1093},{"type":606,"tag":636,"props":2904,"children":2905},{"style":677},[2906],{"type":612,"value":690},{"type":606,"tag":636,"props":2908,"children":2909},{"style":671},[2910],{"type":612,"value":695},{"type":606,"tag":636,"props":2912,"children":2913},{"style":659},[2914],{"type":612,"value":700},{"type":606,"tag":636,"props":2916,"children":2917},{"style":703},[2918],{"type":612,"value":706},{"type":606,"tag":636,"props":2920,"children":2921},{"style":671},[2922],{"type":612,"value":711},{"type":606,"tag":636,"props":2924,"children":2925},{"class":638,"line":99},[2926,2930,2934],{"type":606,"tag":636,"props":2927,"children":2928},{"style":659},[2929],{"type":612,"value":1121},{"type":606,"tag":636,"props":2931,"children":2932},{"style":665},[2933],{"type":612,"value":1126},{"type":606,"tag":636,"props":2935,"children":2936},{"style":671},[2937],{"type":612,"value":711},{"type":606,"tag":636,"props":2939,"children":2940},{"class":638,"line":108},[2941,2945,2949,2953,2958,2962],{"type":606,"tag":636,"props":2942,"children":2943},{"style":671},[2944],{"type":612,"value":1138},{"type":606,"tag":636,"props":2946,"children":2947},{"style":659},[2948],{"type":612,"value":724},{"type":606,"tag":636,"props":2950,"children":2951},{"style":703},[2952],{"type":612,"value":706},{"type":606,"tag":636,"props":2954,"children":2955},{"style":671},[2956],{"type":612,"value":2957},".read(",{"type":606,"tag":636,"props":2959,"children":2960},{"style":665},[2961],{"type":612,"value":1485},{"type":606,"tag":636,"props":2963,"children":2964},{"style":671},[2965],{"type":612,"value":780},{"type":606,"tag":636,"props":2967,"children":2968},{"class":638,"line":117},[2969,2973,2977],{"type":606,"tag":636,"props":2970,"children":2971},{"style":659},[2972],{"type":612,"value":1159},{"type":606,"tag":636,"props":2974,"children":2975},{"style":659},[2976],{"type":612,"value":1164},{"type":606,"tag":636,"props":2978,"children":2979},{"style":671},[2980],{"type":612,"value":1169},{"type":606,"tag":636,"props":2982,"children":2983},{"class":638,"line":126},[2984],{"type":606,"tag":636,"props":2985,"children":2986},{"style":659},[2987],{"type":612,"value":1177},{"type":606,"tag":636,"props":2989,"children":2990},{"class":638,"line":135},[2991],{"type":606,"tag":636,"props":2992,"children":2993},{"style":671},[2994],{"type":612,"value":2995},"                hash_func.update(chunk)\n",{"type":606,"tag":636,"props":2997,"children":2998},{"class":638,"line":144},[2999],{"type":606,"tag":636,"props":3000,"children":3001},{"style":671},[3002],{"type":612,"value":2887},{"type":606,"tag":636,"props":3004,"children":3005},{"class":638,"line":153},[3006,3010],{"type":606,"tag":636,"props":3007,"children":3008},{"style":659},[3009],{"type":612,"value":1595},{"type":606,"tag":636,"props":3011,"children":3012},{"style":671},[3013],{"type":612,"value":3014}," hash_func.hexdigest()\n",{"type":606,"tag":636,"props":3016,"children":3017},{"class":638,"line":163},[3018,3022,3026],{"type":606,"tag":636,"props":3019,"children":3020},{"style":659},[3021],{"type":612,"value":1235},{"type":606,"tag":636,"props":3023,"children":3024},{"style":665},[3025],{"type":612,"value":1240},{"type":606,"tag":636,"props":3027,"children":3028},{"style":671},[3029],{"type":612,"value":711},{"type":606,"tag":636,"props":3031,"children":3032},{"class":638,"line":172},[3033,3037],{"type":606,"tag":636,"props":3034,"children":3035},{"style":659},[3036],{"type":612,"value":1595},{"type":606,"tag":636,"props":3038,"children":3039},{"style":665},[3040],{"type":612,"value":2615},{"type":606,"tag":636,"props":3042,"children":3043},{"class":638,"line":181},[3044],{"type":606,"tag":636,"props":3045,"children":3046},{"emptyLinePlaceholder":13},[3047],{"type":612,"value":788},{"type":606,"tag":636,"props":3049,"children":3050},{"class":638,"line":190},[3051],{"type":606,"tag":636,"props":3052,"children":3053},{"style":642},[3054],{"type":612,"value":3055},"# Example checksum calculation\n",{"type":606,"tag":636,"props":3057,"children":3058},{"class":638,"line":199},[3059,3064,3068,3073,3077],{"type":606,"tag":636,"props":3060,"children":3061},{"style":671},[3062],{"type":612,"value":3063},"checksum ",{"type":606,"tag":636,"props":3065,"children":3066},{"style":659},[3067],{"type":612,"value":724},{"type":606,"tag":636,"props":3069,"children":3070},{"style":671},[3071],{"type":612,"value":3072}," calculate_checksum(",{"type":606,"tag":636,"props":3074,"children":3075},{"style":677},[3076],{"type":612,"value":1936},{"type":606,"tag":636,"props":3078,"children":3079},{"style":671},[3080],{"type":612,"value":780},{"type":606,"tag":636,"props":3082,"children":3083},{"class":638,"line":208},[3084,3088],{"type":606,"tag":636,"props":3085,"children":3086},{"style":659},[3087],{"type":612,"value":2655},{"type":606,"tag":636,"props":3089,"children":3090},{"style":671},[3091],{"type":612,"value":3092}," checksum:\n",{"type":606,"tag":636,"props":3094,"children":3095},{"class":638,"line":217},[3096,3100,3104,3108,3113,3117,3122,3126,3130],{"type":606,"tag":636,"props":3097,"children":3098},{"style":665},[3099],{"type":612,"value":741},{"type":606,"tag":636,"props":3101,"children":3102},{"style":671},[3103],{"type":612,"value":674},{"type":606,"tag":636,"props":3105,"children":3106},{"style":659},[3107],{"type":612,"value":750},{"type":606,"tag":636,"props":3109,"children":3110},{"style":677},[3111],{"type":612,"value":3112},"\"MD5 checksum: ",{"type":606,"tag":636,"props":3114,"children":3115},{"style":665},[3116],{"type":612,"value":1270},{"type":606,"tag":636,"props":3118,"children":3119},{"style":671},[3120],{"type":612,"value":3121},"checksum",{"type":606,"tag":636,"props":3123,"children":3124},{"style":665},[3125],{"type":612,"value":770},{"type":606,"tag":636,"props":3127,"children":3128},{"style":677},[3129],{"type":612,"value":1583},{"type":606,"tag":636,"props":3131,"children":3132},{"style":671},[3133],{"type":612,"value":780},{"type":606,"tag":980,"props":3135,"children":3137},{"id":3136},"object-serialization",[3138],{"type":612,"value":3139},"Object Serialization",{"type":606,"tag":621,"props":3141,"children":3142},{},[3143],{"type":606,"tag":625,"props":3144,"children":3146},{"className":627,"code":3145,"language":629,"meta":8,"style":8},"import pickle\n\n# Working with Python objects (serialization)\ndef save_object(obj, filename):\n    \"\"\"Save Python object to binary file\"\"\"\n    try:\n        with open(filename, 'wb') as file:\n            pickle.dump(obj, file)\n        return True\n    except Exception as e:\n        print(f\"Error saving object: {e}\")\n        return False\n\ndef load_object(filename):\n    \"\"\"Load Python object from binary file\"\"\"\n    try:\n        with open(filename, 'rb') as file:\n            return pickle.load(file)\n    except Exception as e:\n        print(f\"Error loading object: {e}\")\n        return None\n\n# Example with complex object\ndata_object = {\n    'numbers': [1, 2, 3, 4, 5],\n    'text': 'Hello, World!',\n    'nested': {'key': 'value'}\n}\n\nsave_object(data_object, 'object.pickle')\nloaded_object = load_object('object.pickle')\nprint(f\"Loaded object: {loaded_object}\")\n",[3147],{"type":606,"tag":632,"props":3148,"children":3149},{"__ignoreMap":8},[3150,3162,3169,3177,3194,3202,3213,3248,3265,3276,3295,3335,3346,3353,3369,3377,3388,3423,3444,3463,3503,3514,3521,3529,3545,3604,3627,3659,3666,3673,3690,3715],{"type":606,"tag":636,"props":3151,"children":3152},{"class":638,"line":12},[3153,3157],{"type":606,"tag":636,"props":3154,"children":3155},{"style":659},[3156],{"type":612,"value":1003},{"type":606,"tag":636,"props":3158,"children":3159},{"style":671},[3160],{"type":612,"value":3161}," pickle\n",{"type":606,"tag":636,"props":3163,"children":3164},{"class":638,"line":27},[3165],{"type":606,"tag":636,"props":3166,"children":3167},{"emptyLinePlaceholder":13},[3168],{"type":612,"value":788},{"type":606,"tag":636,"props":3170,"children":3171},{"class":638,"line":36},[3172],{"type":606,"tag":636,"props":3173,"children":3174},{"style":642},[3175],{"type":612,"value":3176},"# Working with Python objects (serialization)\n",{"type":606,"tag":636,"props":3178,"children":3179},{"class":638,"line":45},[3180,3184,3189],{"type":606,"tag":636,"props":3181,"children":3182},{"style":659},[3183],{"type":612,"value":1031},{"type":606,"tag":636,"props":3185,"children":3186},{"style":1034},[3187],{"type":612,"value":3188}," save_object",{"type":606,"tag":636,"props":3190,"children":3191},{"style":671},[3192],{"type":612,"value":3193},"(obj, filename):\n",{"type":606,"tag":636,"props":3195,"children":3196},{"class":638,"line":54},[3197],{"type":606,"tag":636,"props":3198,"children":3199},{"style":677},[3200],{"type":612,"value":3201},"    \"\"\"Save Python object to binary file\"\"\"\n",{"type":606,"tag":636,"props":3203,"children":3204},{"class":638,"line":63},[3205,3209],{"type":606,"tag":636,"props":3206,"children":3207},{"style":659},[3208],{"type":612,"value":1072},{"type":606,"tag":636,"props":3210,"children":3211},{"style":671},[3212],{"type":612,"value":711},{"type":606,"tag":636,"props":3214,"children":3215},{"class":638,"line":72},[3216,3220,3224,3228,3232,3236,3240,3244],{"type":606,"tag":636,"props":3217,"children":3218},{"style":659},[3219],{"type":612,"value":1084},{"type":606,"tag":636,"props":3221,"children":3222},{"style":665},[3223],{"type":612,"value":668},{"type":606,"tag":636,"props":3225,"children":3226},{"style":671},[3227],{"type":612,"value":1093},{"type":606,"tag":636,"props":3229,"children":3230},{"style":677},[3231],{"type":612,"value":825},{"type":606,"tag":636,"props":3233,"children":3234},{"style":671},[3235],{"type":612,"value":695},{"type":606,"tag":636,"props":3237,"children":3238},{"style":659},[3239],{"type":612,"value":700},{"type":606,"tag":636,"props":3241,"children":3242},{"style":703},[3243],{"type":612,"value":706},{"type":606,"tag":636,"props":3245,"children":3246},{"style":671},[3247],{"type":612,"value":711},{"type":606,"tag":636,"props":3249,"children":3250},{"class":638,"line":81},[3251,3256,3261],{"type":606,"tag":636,"props":3252,"children":3253},{"style":671},[3254],{"type":612,"value":3255},"            pickle.dump(obj, ",{"type":606,"tag":636,"props":3257,"children":3258},{"style":703},[3259],{"type":612,"value":3260},"file",{"type":606,"tag":636,"props":3262,"children":3263},{"style":671},[3264],{"type":612,"value":780},{"type":606,"tag":636,"props":3266,"children":3267},{"class":638,"line":844},[3268,3272],{"type":606,"tag":636,"props":3269,"children":3270},{"style":659},[3271],{"type":612,"value":1595},{"type":606,"tag":636,"props":3273,"children":3274},{"style":665},[3275],{"type":612,"value":1600},{"type":606,"tag":636,"props":3277,"children":3278},{"class":638,"line":99},[3279,3283,3287,3291],{"type":606,"tag":636,"props":3280,"children":3281},{"style":659},[3282],{"type":612,"value":1235},{"type":606,"tag":636,"props":3284,"children":3285},{"style":665},[3286],{"type":612,"value":1612},{"type":606,"tag":636,"props":3288,"children":3289},{"style":659},[3290],{"type":612,"value":1617},{"type":606,"tag":636,"props":3292,"children":3293},{"style":671},[3294],{"type":612,"value":1622},{"type":606,"tag":636,"props":3296,"children":3297},{"class":638,"line":108},[3298,3302,3306,3310,3315,3319,3323,3327,3331],{"type":606,"tag":636,"props":3299,"children":3300},{"style":665},[3301],{"type":612,"value":1252},{"type":606,"tag":636,"props":3303,"children":3304},{"style":671},[3305],{"type":612,"value":674},{"type":606,"tag":636,"props":3307,"children":3308},{"style":659},[3309],{"type":612,"value":750},{"type":606,"tag":636,"props":3311,"children":3312},{"style":677},[3313],{"type":612,"value":3314},"\"Error saving object: ",{"type":606,"tag":636,"props":3316,"children":3317},{"style":665},[3318],{"type":612,"value":1270},{"type":606,"tag":636,"props":3320,"children":3321},{"style":671},[3322],{"type":612,"value":1651},{"type":606,"tag":636,"props":3324,"children":3325},{"style":665},[3326],{"type":612,"value":770},{"type":606,"tag":636,"props":3328,"children":3329},{"style":677},[3330],{"type":612,"value":1583},{"type":606,"tag":636,"props":3332,"children":3333},{"style":671},[3334],{"type":612,"value":780},{"type":606,"tag":636,"props":3336,"children":3337},{"class":638,"line":117},[3338,3342],{"type":606,"tag":636,"props":3339,"children":3340},{"style":659},[3341],{"type":612,"value":1595},{"type":606,"tag":636,"props":3343,"children":3344},{"style":665},[3345],{"type":612,"value":1675},{"type":606,"tag":636,"props":3347,"children":3348},{"class":638,"line":126},[3349],{"type":606,"tag":636,"props":3350,"children":3351},{"emptyLinePlaceholder":13},[3352],{"type":612,"value":788},{"type":606,"tag":636,"props":3354,"children":3355},{"class":638,"line":135},[3356,3360,3365],{"type":606,"tag":636,"props":3357,"children":3358},{"style":659},[3359],{"type":612,"value":1031},{"type":606,"tag":636,"props":3361,"children":3362},{"style":1034},[3363],{"type":612,"value":3364}," load_object",{"type":606,"tag":636,"props":3366,"children":3367},{"style":671},[3368],{"type":612,"value":2405},{"type":606,"tag":636,"props":3370,"children":3371},{"class":638,"line":144},[3372],{"type":606,"tag":636,"props":3373,"children":3374},{"style":677},[3375],{"type":612,"value":3376},"    \"\"\"Load Python object from binary file\"\"\"\n",{"type":606,"tag":636,"props":3378,"children":3379},{"class":638,"line":153},[3380,3384],{"type":606,"tag":636,"props":3381,"children":3382},{"style":659},[3383],{"type":612,"value":1072},{"type":606,"tag":636,"props":3385,"children":3386},{"style":671},[3387],{"type":612,"value":711},{"type":606,"tag":636,"props":3389,"children":3390},{"class":638,"line":163},[3391,3395,3399,3403,3407,3411,3415,3419],{"type":606,"tag":636,"props":3392,"children":3393},{"style":659},[3394],{"type":612,"value":1084},{"type":606,"tag":636,"props":3396,"children":3397},{"style":665},[3398],{"type":612,"value":668},{"type":606,"tag":636,"props":3400,"children":3401},{"style":671},[3402],{"type":612,"value":1093},{"type":606,"tag":636,"props":3404,"children":3405},{"style":677},[3406],{"type":612,"value":690},{"type":606,"tag":636,"props":3408,"children":3409},{"style":671},[3410],{"type":612,"value":695},{"type":606,"tag":636,"props":3412,"children":3413},{"style":659},[3414],{"type":612,"value":700},{"type":606,"tag":636,"props":3416,"children":3417},{"style":703},[3418],{"type":612,"value":706},{"type":606,"tag":636,"props":3420,"children":3421},{"style":671},[3422],{"type":612,"value":711},{"type":606,"tag":636,"props":3424,"children":3425},{"class":638,"line":172},[3426,3431,3436,3440],{"type":606,"tag":636,"props":3427,"children":3428},{"style":659},[3429],{"type":612,"value":3430},"            return",{"type":606,"tag":636,"props":3432,"children":3433},{"style":671},[3434],{"type":612,"value":3435}," pickle.load(",{"type":606,"tag":636,"props":3437,"children":3438},{"style":703},[3439],{"type":612,"value":3260},{"type":606,"tag":636,"props":3441,"children":3442},{"style":671},[3443],{"type":612,"value":780},{"type":606,"tag":636,"props":3445,"children":3446},{"class":638,"line":181},[3447,3451,3455,3459],{"type":606,"tag":636,"props":3448,"children":3449},{"style":659},[3450],{"type":612,"value":1235},{"type":606,"tag":636,"props":3452,"children":3453},{"style":665},[3454],{"type":612,"value":1612},{"type":606,"tag":636,"props":3456,"children":3457},{"style":659},[3458],{"type":612,"value":1617},{"type":606,"tag":636,"props":3460,"children":3461},{"style":671},[3462],{"type":612,"value":1622},{"type":606,"tag":636,"props":3464,"children":3465},{"class":638,"line":190},[3466,3470,3474,3478,3483,3487,3491,3495,3499],{"type":606,"tag":636,"props":3467,"children":3468},{"style":665},[3469],{"type":612,"value":1252},{"type":606,"tag":636,"props":3471,"children":3472},{"style":671},[3473],{"type":612,"value":674},{"type":606,"tag":636,"props":3475,"children":3476},{"style":659},[3477],{"type":612,"value":750},{"type":606,"tag":636,"props":3479,"children":3480},{"style":677},[3481],{"type":612,"value":3482},"\"Error loading object: ",{"type":606,"tag":636,"props":3484,"children":3485},{"style":665},[3486],{"type":612,"value":1270},{"type":606,"tag":636,"props":3488,"children":3489},{"style":671},[3490],{"type":612,"value":1651},{"type":606,"tag":636,"props":3492,"children":3493},{"style":665},[3494],{"type":612,"value":770},{"type":606,"tag":636,"props":3496,"children":3497},{"style":677},[3498],{"type":612,"value":1583},{"type":606,"tag":636,"props":3500,"children":3501},{"style":671},[3502],{"type":612,"value":780},{"type":606,"tag":636,"props":3504,"children":3505},{"class":638,"line":199},[3506,3510],{"type":606,"tag":636,"props":3507,"children":3508},{"style":659},[3509],{"type":612,"value":1595},{"type":606,"tag":636,"props":3511,"children":3512},{"style":665},[3513],{"type":612,"value":2615},{"type":606,"tag":636,"props":3515,"children":3516},{"class":638,"line":208},[3517],{"type":606,"tag":636,"props":3518,"children":3519},{"emptyLinePlaceholder":13},[3520],{"type":612,"value":788},{"type":606,"tag":636,"props":3522,"children":3523},{"class":638,"line":217},[3524],{"type":606,"tag":636,"props":3525,"children":3526},{"style":642},[3527],{"type":612,"value":3528},"# Example with complex object\n",{"type":606,"tag":636,"props":3530,"children":3531},{"class":638,"line":227},[3532,3537,3541],{"type":606,"tag":636,"props":3533,"children":3534},{"style":671},[3535],{"type":612,"value":3536},"data_object ",{"type":606,"tag":636,"props":3538,"children":3539},{"style":659},[3540],{"type":612,"value":724},{"type":606,"tag":636,"props":3542,"children":3543},{"style":671},[3544],{"type":612,"value":2453},{"type":606,"tag":636,"props":3546,"children":3547},{"class":638,"line":236},[3548,3553,3558,3563,3567,3572,3576,3581,3585,3590,3594,3599],{"type":606,"tag":636,"props":3549,"children":3550},{"style":677},[3551],{"type":612,"value":3552},"    'numbers'",{"type":606,"tag":636,"props":3554,"children":3555},{"style":671},[3556],{"type":612,"value":3557},": [",{"type":606,"tag":636,"props":3559,"children":3560},{"style":665},[3561],{"type":612,"value":3562},"1",{"type":606,"tag":636,"props":3564,"children":3565},{"style":671},[3566],{"type":612,"value":685},{"type":606,"tag":636,"props":3568,"children":3569},{"style":665},[3570],{"type":612,"value":3571},"2",{"type":606,"tag":636,"props":3573,"children":3574},{"style":671},[3575],{"type":612,"value":685},{"type":606,"tag":636,"props":3577,"children":3578},{"style":665},[3579],{"type":612,"value":3580},"3",{"type":606,"tag":636,"props":3582,"children":3583},{"style":671},[3584],{"type":612,"value":685},{"type":606,"tag":636,"props":3586,"children":3587},{"style":665},[3588],{"type":612,"value":3589},"4",{"type":606,"tag":636,"props":3591,"children":3592},{"style":671},[3593],{"type":612,"value":685},{"type":606,"tag":636,"props":3595,"children":3596},{"style":665},[3597],{"type":612,"value":3598},"5",{"type":606,"tag":636,"props":3600,"children":3601},{"style":671},[3602],{"type":612,"value":3603},"],\n",{"type":606,"tag":636,"props":3605,"children":3606},{"class":638,"line":245},[3607,3612,3617,3622],{"type":606,"tag":636,"props":3608,"children":3609},{"style":677},[3610],{"type":612,"value":3611},"    'text'",{"type":606,"tag":636,"props":3613,"children":3614},{"style":671},[3615],{"type":612,"value":3616},": ",{"type":606,"tag":636,"props":3618,"children":3619},{"style":677},[3620],{"type":612,"value":3621},"'Hello, World!'",{"type":606,"tag":636,"props":3623,"children":3624},{"style":671},[3625],{"type":612,"value":3626},",\n",{"type":606,"tag":636,"props":3628,"children":3629},{"class":638,"line":254},[3630,3635,3640,3645,3649,3654],{"type":606,"tag":636,"props":3631,"children":3632},{"style":677},[3633],{"type":612,"value":3634},"    'nested'",{"type":606,"tag":636,"props":3636,"children":3637},{"style":671},[3638],{"type":612,"value":3639},": {",{"type":606,"tag":636,"props":3641,"children":3642},{"style":677},[3643],{"type":612,"value":3644},"'key'",{"type":606,"tag":636,"props":3646,"children":3647},{"style":671},[3648],{"type":612,"value":3616},{"type":606,"tag":636,"props":3650,"children":3651},{"style":677},[3652],{"type":612,"value":3653},"'value'",{"type":606,"tag":636,"props":3655,"children":3656},{"style":671},[3657],{"type":612,"value":3658},"}\n",{"type":606,"tag":636,"props":3660,"children":3661},{"class":638,"line":263},[3662],{"type":606,"tag":636,"props":3663,"children":3664},{"style":671},[3665],{"type":612,"value":3658},{"type":606,"tag":636,"props":3667,"children":3668},{"class":638,"line":272},[3669],{"type":606,"tag":636,"props":3670,"children":3671},{"emptyLinePlaceholder":13},[3672],{"type":612,"value":788},{"type":606,"tag":636,"props":3674,"children":3675},{"class":638,"line":281},[3676,3681,3686],{"type":606,"tag":636,"props":3677,"children":3678},{"style":671},[3679],{"type":612,"value":3680},"save_object(data_object, ",{"type":606,"tag":636,"props":3682,"children":3683},{"style":677},[3684],{"type":612,"value":3685},"'object.pickle'",{"type":606,"tag":636,"props":3687,"children":3688},{"style":671},[3689],{"type":612,"value":780},{"type":606,"tag":636,"props":3691,"children":3692},{"class":638,"line":291},[3693,3698,3702,3707,3711],{"type":606,"tag":636,"props":3694,"children":3695},{"style":671},[3696],{"type":612,"value":3697},"loaded_object ",{"type":606,"tag":636,"props":3699,"children":3700},{"style":659},[3701],{"type":612,"value":724},{"type":606,"tag":636,"props":3703,"children":3704},{"style":671},[3705],{"type":612,"value":3706}," load_object(",{"type":606,"tag":636,"props":3708,"children":3709},{"style":677},[3710],{"type":612,"value":3685},{"type":606,"tag":636,"props":3712,"children":3713},{"style":671},[3714],{"type":612,"value":780},{"type":606,"tag":636,"props":3716,"children":3717},{"class":638,"line":302},[3718,3722,3726,3730,3735,3739,3744,3748,3752],{"type":606,"tag":636,"props":3719,"children":3720},{"style":665},[3721],{"type":612,"value":1732},{"type":606,"tag":636,"props":3723,"children":3724},{"style":671},[3725],{"type":612,"value":674},{"type":606,"tag":636,"props":3727,"children":3728},{"style":659},[3729],{"type":612,"value":750},{"type":606,"tag":636,"props":3731,"children":3732},{"style":677},[3733],{"type":612,"value":3734},"\"Loaded object: ",{"type":606,"tag":636,"props":3736,"children":3737},{"style":665},[3738],{"type":612,"value":1270},{"type":606,"tag":636,"props":3740,"children":3741},{"style":671},[3742],{"type":612,"value":3743},"loaded_object",{"type":606,"tag":636,"props":3745,"children":3746},{"style":665},[3747],{"type":612,"value":770},{"type":606,"tag":636,"props":3749,"children":3750},{"style":677},[3751],{"type":612,"value":1583},{"type":606,"tag":636,"props":3753,"children":3754},{"style":671},[3755],{"type":612,"value":780},{"type":606,"tag":980,"props":3757,"children":3759},{"id":3758},"file-comparison",[3760],{"type":612,"value":3761},"File Comparison",{"type":606,"tag":621,"props":3763,"children":3764},{},[3765],{"type":606,"tag":625,"props":3766,"children":3768},{"className":627,"code":3767,"language":629,"meta":8,"style":8},"# Binary file comparison\ndef compare_binary_files(file1, file2):\n    \"\"\"Compare two binary files\"\"\"\n    try:\n        with open(file1, 'rb') as f1, open(file2, 'rb') as f2:\n            while True:\n                chunk1 = f1.read(8192)\n                chunk2 = f2.read(8192)\n                \n                if chunk1 != chunk2:\n                    return False\n                \n                if not chunk1:  # End of both files\n                    return True\n    except Exception as e:\n        print(f\"Comparison error: {e}\")\n        return False\n\n# Example comparison\nare_same = compare_binary_files('file1.bin', 'file2.bin')\nprint(f\"Files are identical: {are_same}\")\n",[3769],{"type":606,"tag":632,"props":3770,"children":3771},{"__ignoreMap":8},[3772,3780,3797,3805,3816,3876,3891,3916,3941,3949,3971,3983,3990,4011,4022,4041,4081,4092,4099,4107,4142],{"type":606,"tag":636,"props":3773,"children":3774},{"class":638,"line":12},[3775],{"type":606,"tag":636,"props":3776,"children":3777},{"style":642},[3778],{"type":612,"value":3779},"# Binary file comparison\n",{"type":606,"tag":636,"props":3781,"children":3782},{"class":638,"line":27},[3783,3787,3792],{"type":606,"tag":636,"props":3784,"children":3785},{"style":659},[3786],{"type":612,"value":1031},{"type":606,"tag":636,"props":3788,"children":3789},{"style":1034},[3790],{"type":612,"value":3791}," compare_binary_files",{"type":606,"tag":636,"props":3793,"children":3794},{"style":671},[3795],{"type":612,"value":3796},"(file1, file2):\n",{"type":606,"tag":636,"props":3798,"children":3799},{"class":638,"line":36},[3800],{"type":606,"tag":636,"props":3801,"children":3802},{"style":677},[3803],{"type":612,"value":3804},"    \"\"\"Compare two binary files\"\"\"\n",{"type":606,"tag":636,"props":3806,"children":3807},{"class":638,"line":45},[3808,3812],{"type":606,"tag":636,"props":3809,"children":3810},{"style":659},[3811],{"type":612,"value":1072},{"type":606,"tag":636,"props":3813,"children":3814},{"style":671},[3815],{"type":612,"value":711},{"type":606,"tag":636,"props":3817,"children":3818},{"class":638,"line":54},[3819,3823,3827,3832,3836,3840,3844,3849,3854,3859,3863,3867,3871],{"type":606,"tag":636,"props":3820,"children":3821},{"style":659},[3822],{"type":612,"value":1084},{"type":606,"tag":636,"props":3824,"children":3825},{"style":665},[3826],{"type":612,"value":668},{"type":606,"tag":636,"props":3828,"children":3829},{"style":671},[3830],{"type":612,"value":3831},"(file1, ",{"type":606,"tag":636,"props":3833,"children":3834},{"style":677},[3835],{"type":612,"value":690},{"type":606,"tag":636,"props":3837,"children":3838},{"style":671},[3839],{"type":612,"value":695},{"type":606,"tag":636,"props":3841,"children":3842},{"style":659},[3843],{"type":612,"value":700},{"type":606,"tag":636,"props":3845,"children":3846},{"style":671},[3847],{"type":612,"value":3848}," f1, ",{"type":606,"tag":636,"props":3850,"children":3851},{"style":665},[3852],{"type":612,"value":3853},"open",{"type":606,"tag":636,"props":3855,"children":3856},{"style":671},[3857],{"type":612,"value":3858},"(file2, ",{"type":606,"tag":636,"props":3860,"children":3861},{"style":677},[3862],{"type":612,"value":690},{"type":606,"tag":636,"props":3864,"children":3865},{"style":671},[3866],{"type":612,"value":695},{"type":606,"tag":636,"props":3868,"children":3869},{"style":659},[3870],{"type":612,"value":700},{"type":606,"tag":636,"props":3872,"children":3873},{"style":671},[3874],{"type":612,"value":3875}," f2:\n",{"type":606,"tag":636,"props":3877,"children":3878},{"class":638,"line":63},[3879,3883,3887],{"type":606,"tag":636,"props":3880,"children":3881},{"style":659},[3882],{"type":612,"value":1121},{"type":606,"tag":636,"props":3884,"children":3885},{"style":665},[3886],{"type":612,"value":1126},{"type":606,"tag":636,"props":3888,"children":3889},{"style":671},[3890],{"type":612,"value":711},{"type":606,"tag":636,"props":3892,"children":3893},{"class":638,"line":72},[3894,3899,3903,3908,3912],{"type":606,"tag":636,"props":3895,"children":3896},{"style":671},[3897],{"type":612,"value":3898},"                chunk1 ",{"type":606,"tag":636,"props":3900,"children":3901},{"style":659},[3902],{"type":612,"value":724},{"type":606,"tag":636,"props":3904,"children":3905},{"style":671},[3906],{"type":612,"value":3907}," f1.read(",{"type":606,"tag":636,"props":3909,"children":3910},{"style":665},[3911],{"type":612,"value":1485},{"type":606,"tag":636,"props":3913,"children":3914},{"style":671},[3915],{"type":612,"value":780},{"type":606,"tag":636,"props":3917,"children":3918},{"class":638,"line":81},[3919,3924,3928,3933,3937],{"type":606,"tag":636,"props":3920,"children":3921},{"style":671},[3922],{"type":612,"value":3923},"                chunk2 ",{"type":606,"tag":636,"props":3925,"children":3926},{"style":659},[3927],{"type":612,"value":724},{"type":606,"tag":636,"props":3929,"children":3930},{"style":671},[3931],{"type":612,"value":3932}," f2.read(",{"type":606,"tag":636,"props":3934,"children":3935},{"style":665},[3936],{"type":612,"value":1485},{"type":606,"tag":636,"props":3938,"children":3939},{"style":671},[3940],{"type":612,"value":780},{"type":606,"tag":636,"props":3942,"children":3943},{"class":638,"line":844},[3944],{"type":606,"tag":636,"props":3945,"children":3946},{"style":671},[3947],{"type":612,"value":3948},"                \n",{"type":606,"tag":636,"props":3950,"children":3951},{"class":638,"line":99},[3952,3956,3961,3966],{"type":606,"tag":636,"props":3953,"children":3954},{"style":659},[3955],{"type":612,"value":1159},{"type":606,"tag":636,"props":3957,"children":3958},{"style":671},[3959],{"type":612,"value":3960}," chunk1 ",{"type":606,"tag":636,"props":3962,"children":3963},{"style":659},[3964],{"type":612,"value":3965},"!=",{"type":606,"tag":636,"props":3967,"children":3968},{"style":671},[3969],{"type":612,"value":3970}," chunk2:\n",{"type":606,"tag":636,"props":3972,"children":3973},{"class":638,"line":108},[3974,3979],{"type":606,"tag":636,"props":3975,"children":3976},{"style":659},[3977],{"type":612,"value":3978},"                    return",{"type":606,"tag":636,"props":3980,"children":3981},{"style":665},[3982],{"type":612,"value":1675},{"type":606,"tag":636,"props":3984,"children":3985},{"class":638,"line":117},[3986],{"type":606,"tag":636,"props":3987,"children":3988},{"style":671},[3989],{"type":612,"value":3948},{"type":606,"tag":636,"props":3991,"children":3992},{"class":638,"line":126},[3993,3997,4001,4006],{"type":606,"tag":636,"props":3994,"children":3995},{"style":659},[3996],{"type":612,"value":1159},{"type":606,"tag":636,"props":3998,"children":3999},{"style":659},[4000],{"type":612,"value":1164},{"type":606,"tag":636,"props":4002,"children":4003},{"style":671},[4004],{"type":612,"value":4005}," chunk1:  ",{"type":606,"tag":636,"props":4007,"children":4008},{"style":642},[4009],{"type":612,"value":4010},"# End of both files\n",{"type":606,"tag":636,"props":4012,"children":4013},{"class":638,"line":135},[4014,4018],{"type":606,"tag":636,"props":4015,"children":4016},{"style":659},[4017],{"type":612,"value":3978},{"type":606,"tag":636,"props":4019,"children":4020},{"style":665},[4021],{"type":612,"value":1600},{"type":606,"tag":636,"props":4023,"children":4024},{"class":638,"line":144},[4025,4029,4033,4037],{"type":606,"tag":636,"props":4026,"children":4027},{"style":659},[4028],{"type":612,"value":1235},{"type":606,"tag":636,"props":4030,"children":4031},{"style":665},[4032],{"type":612,"value":1612},{"type":606,"tag":636,"props":4034,"children":4035},{"style":659},[4036],{"type":612,"value":1617},{"type":606,"tag":636,"props":4038,"children":4039},{"style":671},[4040],{"type":612,"value":1622},{"type":606,"tag":636,"props":4042,"children":4043},{"class":638,"line":153},[4044,4048,4052,4056,4061,4065,4069,4073,4077],{"type":606,"tag":636,"props":4045,"children":4046},{"style":665},[4047],{"type":612,"value":1252},{"type":606,"tag":636,"props":4049,"children":4050},{"style":671},[4051],{"type":612,"value":674},{"type":606,"tag":636,"props":4053,"children":4054},{"style":659},[4055],{"type":612,"value":750},{"type":606,"tag":636,"props":4057,"children":4058},{"style":677},[4059],{"type":612,"value":4060},"\"Comparison error: ",{"type":606,"tag":636,"props":4062,"children":4063},{"style":665},[4064],{"type":612,"value":1270},{"type":606,"tag":636,"props":4066,"children":4067},{"style":671},[4068],{"type":612,"value":1651},{"type":606,"tag":636,"props":4070,"children":4071},{"style":665},[4072],{"type":612,"value":770},{"type":606,"tag":636,"props":4074,"children":4075},{"style":677},[4076],{"type":612,"value":1583},{"type":606,"tag":636,"props":4078,"children":4079},{"style":671},[4080],{"type":612,"value":780},{"type":606,"tag":636,"props":4082,"children":4083},{"class":638,"line":163},[4084,4088],{"type":606,"tag":636,"props":4085,"children":4086},{"style":659},[4087],{"type":612,"value":1595},{"type":606,"tag":636,"props":4089,"children":4090},{"style":665},[4091],{"type":612,"value":1675},{"type":606,"tag":636,"props":4093,"children":4094},{"class":638,"line":172},[4095],{"type":606,"tag":636,"props":4096,"children":4097},{"emptyLinePlaceholder":13},[4098],{"type":612,"value":788},{"type":606,"tag":636,"props":4100,"children":4101},{"class":638,"line":181},[4102],{"type":606,"tag":636,"props":4103,"children":4104},{"style":642},[4105],{"type":612,"value":4106},"# Example comparison\n",{"type":606,"tag":636,"props":4108,"children":4109},{"class":638,"line":190},[4110,4115,4119,4124,4129,4133,4138],{"type":606,"tag":636,"props":4111,"children":4112},{"style":671},[4113],{"type":612,"value":4114},"are_same ",{"type":606,"tag":636,"props":4116,"children":4117},{"style":659},[4118],{"type":612,"value":724},{"type":606,"tag":636,"props":4120,"children":4121},{"style":671},[4122],{"type":612,"value":4123}," compare_binary_files(",{"type":606,"tag":636,"props":4125,"children":4126},{"style":677},[4127],{"type":612,"value":4128},"'file1.bin'",{"type":606,"tag":636,"props":4130,"children":4131},{"style":671},[4132],{"type":612,"value":685},{"type":606,"tag":636,"props":4134,"children":4135},{"style":677},[4136],{"type":612,"value":4137},"'file2.bin'",{"type":606,"tag":636,"props":4139,"children":4140},{"style":671},[4141],{"type":612,"value":780},{"type":606,"tag":636,"props":4143,"children":4144},{"class":638,"line":199},[4145,4149,4153,4157,4162,4166,4171,4175,4179],{"type":606,"tag":636,"props":4146,"children":4147},{"style":665},[4148],{"type":612,"value":1732},{"type":606,"tag":636,"props":4150,"children":4151},{"style":671},[4152],{"type":612,"value":674},{"type":606,"tag":636,"props":4154,"children":4155},{"style":659},[4156],{"type":612,"value":750},{"type":606,"tag":636,"props":4158,"children":4159},{"style":677},[4160],{"type":612,"value":4161},"\"Files are identical: ",{"type":606,"tag":636,"props":4163,"children":4164},{"style":665},[4165],{"type":612,"value":1270},{"type":606,"tag":636,"props":4167,"children":4168},{"style":671},[4169],{"type":612,"value":4170},"are_same",{"type":606,"tag":636,"props":4172,"children":4173},{"style":665},[4174],{"type":612,"value":770},{"type":606,"tag":636,"props":4176,"children":4177},{"style":677},[4178],{"type":612,"value":1583},{"type":606,"tag":636,"props":4180,"children":4181},{"style":671},[4182],{"type":612,"value":780},{"type":606,"tag":980,"props":4184,"children":4186},{"id":4185},"binary-file-handler-class",[4187],{"type":612,"value":4188},"Binary File Handler Class",{"type":606,"tag":621,"props":4190,"children":4191},{},[4192],{"type":606,"tag":625,"props":4193,"children":4195},{"className":627,"code":4194,"language":629,"meta":8,"style":8},"from pathlib import Path\n\n# Safe binary file operations\nclass BinaryFileHandler:\n    def __init__(self, filename):\n        self.filename = Path(filename)\n    \n    def read_all(self):\n        \"\"\"Read entire binary file\"\"\"\n        try:\n            with open(self.filename, 'rb') as file:\n                return file.read()\n        except Exception as e:\n            print(f\"Read error: {e}\")\n            return None\n    \n    def write_all(self, data):\n        \"\"\"Write data to binary file\"\"\"\n        try:\n            # Create directory if needed\n            self.filename.parent.mkdir(parents=True, exist_ok=True)\n            \n            with open(self.filename, 'wb') as file:\n                file.write(data)\n            return True\n        except Exception as e:\n            print(f\"Write error: {e}\")\n            return False\n\n# Example usage\nhandler = BinaryFileHandler('binary_data.bin')\nhandler.write_all(b'Hello, binary world!')\ncontent = handler.read_all()\nprint(f\"File content: {content}\")\n",[4196],{"type":606,"tag":632,"props":4197,"children":4198},{"__ignoreMap":8},[4199,4221,4228,4236,4253,4271,4293,4300,4317,4325,4337,4382,4398,4418,4458,4469,4476,4493,4501,4512,4520,4568,4576,4619,4631,4642,4661,4701,4712,4719,4726,4752,4773,4790],{"type":606,"tag":636,"props":4200,"children":4201},{"class":638,"line":12},[4202,4207,4212,4216],{"type":606,"tag":636,"props":4203,"children":4204},{"style":659},[4205],{"type":612,"value":4206},"from",{"type":606,"tag":636,"props":4208,"children":4209},{"style":671},[4210],{"type":612,"value":4211}," pathlib ",{"type":606,"tag":636,"props":4213,"children":4214},{"style":659},[4215],{"type":612,"value":1003},{"type":606,"tag":636,"props":4217,"children":4218},{"style":671},[4219],{"type":612,"value":4220}," Path\n",{"type":606,"tag":636,"props":4222,"children":4223},{"class":638,"line":27},[4224],{"type":606,"tag":636,"props":4225,"children":4226},{"emptyLinePlaceholder":13},[4227],{"type":612,"value":788},{"type":606,"tag":636,"props":4229,"children":4230},{"class":638,"line":36},[4231],{"type":606,"tag":636,"props":4232,"children":4233},{"style":642},[4234],{"type":612,"value":4235},"# Safe binary file operations\n",{"type":606,"tag":636,"props":4237,"children":4238},{"class":638,"line":45},[4239,4244,4249],{"type":606,"tag":636,"props":4240,"children":4241},{"style":659},[4242],{"type":612,"value":4243},"class",{"type":606,"tag":636,"props":4245,"children":4246},{"style":1034},[4247],{"type":612,"value":4248}," BinaryFileHandler",{"type":606,"tag":636,"props":4250,"children":4251},{"style":671},[4252],{"type":612,"value":711},{"type":606,"tag":636,"props":4254,"children":4255},{"class":638,"line":54},[4256,4261,4266],{"type":606,"tag":636,"props":4257,"children":4258},{"style":659},[4259],{"type":612,"value":4260},"    def",{"type":606,"tag":636,"props":4262,"children":4263},{"style":665},[4264],{"type":612,"value":4265}," __init__",{"type":606,"tag":636,"props":4267,"children":4268},{"style":671},[4269],{"type":612,"value":4270},"(self, filename):\n",{"type":606,"tag":636,"props":4272,"children":4273},{"class":638,"line":63},[4274,4279,4284,4288],{"type":606,"tag":636,"props":4275,"children":4276},{"style":665},[4277],{"type":612,"value":4278},"        self",{"type":606,"tag":636,"props":4280,"children":4281},{"style":671},[4282],{"type":612,"value":4283},".filename ",{"type":606,"tag":636,"props":4285,"children":4286},{"style":659},[4287],{"type":612,"value":724},{"type":606,"tag":636,"props":4289,"children":4290},{"style":671},[4291],{"type":612,"value":4292}," Path(filename)\n",{"type":606,"tag":636,"props":4294,"children":4295},{"class":638,"line":72},[4296],{"type":606,"tag":636,"props":4297,"children":4298},{"style":671},[4299],{"type":612,"value":1915},{"type":606,"tag":636,"props":4301,"children":4302},{"class":638,"line":81},[4303,4307,4312],{"type":606,"tag":636,"props":4304,"children":4305},{"style":659},[4306],{"type":612,"value":4260},{"type":606,"tag":636,"props":4308,"children":4309},{"style":1034},[4310],{"type":612,"value":4311}," read_all",{"type":606,"tag":636,"props":4313,"children":4314},{"style":671},[4315],{"type":612,"value":4316},"(self):\n",{"type":606,"tag":636,"props":4318,"children":4319},{"class":638,"line":844},[4320],{"type":606,"tag":636,"props":4321,"children":4322},{"style":677},[4323],{"type":612,"value":4324},"        \"\"\"Read entire binary file\"\"\"\n",{"type":606,"tag":636,"props":4326,"children":4327},{"class":638,"line":99},[4328,4333],{"type":606,"tag":636,"props":4329,"children":4330},{"style":659},[4331],{"type":612,"value":4332},"        try",{"type":606,"tag":636,"props":4334,"children":4335},{"style":671},[4336],{"type":612,"value":711},{"type":606,"tag":636,"props":4338,"children":4339},{"class":638,"line":108},[4340,4344,4348,4352,4357,4362,4366,4370,4374,4378],{"type":606,"tag":636,"props":4341,"children":4342},{"style":659},[4343],{"type":612,"value":1421},{"type":606,"tag":636,"props":4345,"children":4346},{"style":665},[4347],{"type":612,"value":668},{"type":606,"tag":636,"props":4349,"children":4350},{"style":671},[4351],{"type":612,"value":674},{"type":606,"tag":636,"props":4353,"children":4354},{"style":665},[4355],{"type":612,"value":4356},"self",{"type":606,"tag":636,"props":4358,"children":4359},{"style":671},[4360],{"type":612,"value":4361},".filename, ",{"type":606,"tag":636,"props":4363,"children":4364},{"style":677},[4365],{"type":612,"value":690},{"type":606,"tag":636,"props":4367,"children":4368},{"style":671},[4369],{"type":612,"value":695},{"type":606,"tag":636,"props":4371,"children":4372},{"style":659},[4373],{"type":612,"value":700},{"type":606,"tag":636,"props":4375,"children":4376},{"style":703},[4377],{"type":612,"value":706},{"type":606,"tag":636,"props":4379,"children":4380},{"style":671},[4381],{"type":612,"value":711},{"type":606,"tag":636,"props":4383,"children":4384},{"class":638,"line":117},[4385,4390,4394],{"type":606,"tag":636,"props":4386,"children":4387},{"style":659},[4388],{"type":612,"value":4389},"                return",{"type":606,"tag":636,"props":4391,"children":4392},{"style":703},[4393],{"type":612,"value":706},{"type":606,"tag":636,"props":4395,"children":4396},{"style":671},[4397],{"type":612,"value":733},{"type":606,"tag":636,"props":4399,"children":4400},{"class":638,"line":126},[4401,4406,4410,4414],{"type":606,"tag":636,"props":4402,"children":4403},{"style":659},[4404],{"type":612,"value":4405},"        except",{"type":606,"tag":636,"props":4407,"children":4408},{"style":665},[4409],{"type":612,"value":1612},{"type":606,"tag":636,"props":4411,"children":4412},{"style":659},[4413],{"type":612,"value":1617},{"type":606,"tag":636,"props":4415,"children":4416},{"style":671},[4417],{"type":612,"value":1622},{"type":606,"tag":636,"props":4419,"children":4420},{"class":638,"line":135},[4421,4425,4429,4433,4438,4442,4446,4450,4454],{"type":606,"tag":636,"props":4422,"children":4423},{"style":665},[4424],{"type":612,"value":2166},{"type":606,"tag":636,"props":4426,"children":4427},{"style":671},[4428],{"type":612,"value":674},{"type":606,"tag":636,"props":4430,"children":4431},{"style":659},[4432],{"type":612,"value":750},{"type":606,"tag":636,"props":4434,"children":4435},{"style":677},[4436],{"type":612,"value":4437},"\"Read error: ",{"type":606,"tag":636,"props":4439,"children":4440},{"style":665},[4441],{"type":612,"value":1270},{"type":606,"tag":636,"props":4443,"children":4444},{"style":671},[4445],{"type":612,"value":1651},{"type":606,"tag":636,"props":4447,"children":4448},{"style":665},[4449],{"type":612,"value":770},{"type":606,"tag":636,"props":4451,"children":4452},{"style":677},[4453],{"type":612,"value":1583},{"type":606,"tag":636,"props":4455,"children":4456},{"style":671},[4457],{"type":612,"value":780},{"type":606,"tag":636,"props":4459,"children":4460},{"class":638,"line":144},[4461,4465],{"type":606,"tag":636,"props":4462,"children":4463},{"style":659},[4464],{"type":612,"value":3430},{"type":606,"tag":636,"props":4466,"children":4467},{"style":665},[4468],{"type":612,"value":2615},{"type":606,"tag":636,"props":4470,"children":4471},{"class":638,"line":153},[4472],{"type":606,"tag":636,"props":4473,"children":4474},{"style":671},[4475],{"type":612,"value":1915},{"type":606,"tag":636,"props":4477,"children":4478},{"class":638,"line":163},[4479,4483,4488],{"type":606,"tag":636,"props":4480,"children":4481},{"style":659},[4482],{"type":612,"value":4260},{"type":606,"tag":636,"props":4484,"children":4485},{"style":1034},[4486],{"type":612,"value":4487}," write_all",{"type":606,"tag":636,"props":4489,"children":4490},{"style":671},[4491],{"type":612,"value":4492},"(self, data):\n",{"type":606,"tag":636,"props":4494,"children":4495},{"class":638,"line":172},[4496],{"type":606,"tag":636,"props":4497,"children":4498},{"style":677},[4499],{"type":612,"value":4500},"        \"\"\"Write data to binary file\"\"\"\n",{"type":606,"tag":636,"props":4502,"children":4503},{"class":638,"line":181},[4504,4508],{"type":606,"tag":636,"props":4505,"children":4506},{"style":659},[4507],{"type":612,"value":4332},{"type":606,"tag":636,"props":4509,"children":4510},{"style":671},[4511],{"type":612,"value":711},{"type":606,"tag":636,"props":4513,"children":4514},{"class":638,"line":190},[4515],{"type":606,"tag":636,"props":4516,"children":4517},{"style":642},[4518],{"type":612,"value":4519},"            # Create directory if needed\n",{"type":606,"tag":636,"props":4521,"children":4522},{"class":638,"line":199},[4523,4528,4533,4538,4542,4547,4551,4556,4560,4564],{"type":606,"tag":636,"props":4524,"children":4525},{"style":665},[4526],{"type":612,"value":4527},"            self",{"type":606,"tag":636,"props":4529,"children":4530},{"style":671},[4531],{"type":612,"value":4532},".filename.parent.mkdir(",{"type":606,"tag":636,"props":4534,"children":4535},{"style":703},[4536],{"type":612,"value":4537},"parents",{"type":606,"tag":636,"props":4539,"children":4540},{"style":659},[4541],{"type":612,"value":724},{"type":606,"tag":636,"props":4543,"children":4544},{"style":665},[4545],{"type":612,"value":4546},"True",{"type":606,"tag":636,"props":4548,"children":4549},{"style":671},[4550],{"type":612,"value":685},{"type":606,"tag":636,"props":4552,"children":4553},{"style":703},[4554],{"type":612,"value":4555},"exist_ok",{"type":606,"tag":636,"props":4557,"children":4558},{"style":659},[4559],{"type":612,"value":724},{"type":606,"tag":636,"props":4561,"children":4562},{"style":665},[4563],{"type":612,"value":4546},{"type":606,"tag":636,"props":4565,"children":4566},{"style":671},[4567],{"type":612,"value":780},{"type":606,"tag":636,"props":4569,"children":4570},{"class":638,"line":208},[4571],{"type":606,"tag":636,"props":4572,"children":4573},{"style":671},[4574],{"type":612,"value":4575},"            \n",{"type":606,"tag":636,"props":4577,"children":4578},{"class":638,"line":217},[4579,4583,4587,4591,4595,4599,4603,4607,4611,4615],{"type":606,"tag":636,"props":4580,"children":4581},{"style":659},[4582],{"type":612,"value":1421},{"type":606,"tag":636,"props":4584,"children":4585},{"style":665},[4586],{"type":612,"value":668},{"type":606,"tag":636,"props":4588,"children":4589},{"style":671},[4590],{"type":612,"value":674},{"type":606,"tag":636,"props":4592,"children":4593},{"style":665},[4594],{"type":612,"value":4356},{"type":606,"tag":636,"props":4596,"children":4597},{"style":671},[4598],{"type":612,"value":4361},{"type":606,"tag":636,"props":4600,"children":4601},{"style":677},[4602],{"type":612,"value":825},{"type":606,"tag":636,"props":4604,"children":4605},{"style":671},[4606],{"type":612,"value":695},{"type":606,"tag":636,"props":4608,"children":4609},{"style":659},[4610],{"type":612,"value":700},{"type":606,"tag":636,"props":4612,"children":4613},{"style":703},[4614],{"type":612,"value":706},{"type":606,"tag":636,"props":4616,"children":4617},{"style":671},[4618],{"type":612,"value":711},{"type":606,"tag":636,"props":4620,"children":4621},{"class":638,"line":227},[4622,4627],{"type":606,"tag":636,"props":4623,"children":4624},{"style":703},[4625],{"type":612,"value":4626},"                file",{"type":606,"tag":636,"props":4628,"children":4629},{"style":671},[4630],{"type":612,"value":855},{"type":606,"tag":636,"props":4632,"children":4633},{"class":638,"line":236},[4634,4638],{"type":606,"tag":636,"props":4635,"children":4636},{"style":659},[4637],{"type":612,"value":3430},{"type":606,"tag":636,"props":4639,"children":4640},{"style":665},[4641],{"type":612,"value":1600},{"type":606,"tag":636,"props":4643,"children":4644},{"class":638,"line":245},[4645,4649,4653,4657],{"type":606,"tag":636,"props":4646,"children":4647},{"style":659},[4648],{"type":612,"value":4405},{"type":606,"tag":636,"props":4650,"children":4651},{"style":665},[4652],{"type":612,"value":1612},{"type":606,"tag":636,"props":4654,"children":4655},{"style":659},[4656],{"type":612,"value":1617},{"type":606,"tag":636,"props":4658,"children":4659},{"style":671},[4660],{"type":612,"value":1622},{"type":606,"tag":636,"props":4662,"children":4663},{"class":638,"line":254},[4664,4668,4672,4676,4681,4685,4689,4693,4697],{"type":606,"tag":636,"props":4665,"children":4666},{"style":665},[4667],{"type":612,"value":2166},{"type":606,"tag":636,"props":4669,"children":4670},{"style":671},[4671],{"type":612,"value":674},{"type":606,"tag":636,"props":4673,"children":4674},{"style":659},[4675],{"type":612,"value":750},{"type":606,"tag":636,"props":4677,"children":4678},{"style":677},[4679],{"type":612,"value":4680},"\"Write error: ",{"type":606,"tag":636,"props":4682,"children":4683},{"style":665},[4684],{"type":612,"value":1270},{"type":606,"tag":636,"props":4686,"children":4687},{"style":671},[4688],{"type":612,"value":1651},{"type":606,"tag":636,"props":4690,"children":4691},{"style":665},[4692],{"type":612,"value":770},{"type":606,"tag":636,"props":4694,"children":4695},{"style":677},[4696],{"type":612,"value":1583},{"type":606,"tag":636,"props":4698,"children":4699},{"style":671},[4700],{"type":612,"value":780},{"type":606,"tag":636,"props":4702,"children":4703},{"class":638,"line":263},[4704,4708],{"type":606,"tag":636,"props":4705,"children":4706},{"style":659},[4707],{"type":612,"value":3430},{"type":606,"tag":636,"props":4709,"children":4710},{"style":665},[4711],{"type":612,"value":1675},{"type":606,"tag":636,"props":4713,"children":4714},{"class":638,"line":272},[4715],{"type":606,"tag":636,"props":4716,"children":4717},{"emptyLinePlaceholder":13},[4718],{"type":612,"value":788},{"type":606,"tag":636,"props":4720,"children":4721},{"class":638,"line":281},[4722],{"type":606,"tag":636,"props":4723,"children":4724},{"style":642},[4725],{"type":612,"value":1303},{"type":606,"tag":636,"props":4727,"children":4728},{"class":638,"line":291},[4729,4734,4738,4743,4748],{"type":606,"tag":636,"props":4730,"children":4731},{"style":671},[4732],{"type":612,"value":4733},"handler ",{"type":606,"tag":636,"props":4735,"children":4736},{"style":659},[4737],{"type":612,"value":724},{"type":606,"tag":636,"props":4739,"children":4740},{"style":671},[4741],{"type":612,"value":4742}," BinaryFileHandler(",{"type":606,"tag":636,"props":4744,"children":4745},{"style":677},[4746],{"type":612,"value":4747},"'binary_data.bin'",{"type":606,"tag":636,"props":4749,"children":4750},{"style":671},[4751],{"type":612,"value":780},{"type":606,"tag":636,"props":4753,"children":4754},{"class":638,"line":302},[4755,4760,4764,4769],{"type":606,"tag":636,"props":4756,"children":4757},{"style":671},[4758],{"type":612,"value":4759},"handler.write_all(",{"type":606,"tag":636,"props":4761,"children":4762},{"style":659},[4763],{"type":612,"value":1898},{"type":606,"tag":636,"props":4765,"children":4766},{"style":677},[4767],{"type":612,"value":4768},"'Hello, binary world!'",{"type":606,"tag":636,"props":4770,"children":4771},{"style":671},[4772],{"type":612,"value":780},{"type":606,"tag":636,"props":4774,"children":4775},{"class":638,"line":311},[4776,4781,4785],{"type":606,"tag":636,"props":4777,"children":4778},{"style":671},[4779],{"type":612,"value":4780},"content ",{"type":606,"tag":636,"props":4782,"children":4783},{"style":659},[4784],{"type":612,"value":724},{"type":606,"tag":636,"props":4786,"children":4787},{"style":671},[4788],{"type":612,"value":4789}," handler.read_all()\n",{"type":606,"tag":636,"props":4791,"children":4792},{"class":638,"line":320},[4793,4797,4801,4805,4810,4814,4818,4822,4826],{"type":606,"tag":636,"props":4794,"children":4795},{"style":665},[4796],{"type":612,"value":1732},{"type":606,"tag":636,"props":4798,"children":4799},{"style":671},[4800],{"type":612,"value":674},{"type":606,"tag":636,"props":4802,"children":4803},{"style":659},[4804],{"type":612,"value":750},{"type":606,"tag":636,"props":4806,"children":4807},{"style":677},[4808],{"type":612,"value":4809},"\"File content: ",{"type":606,"tag":636,"props":4811,"children":4812},{"style":665},[4813],{"type":612,"value":1270},{"type":606,"tag":636,"props":4815,"children":4816},{"style":671},[4817],{"type":612,"value":17},{"type":606,"tag":636,"props":4819,"children":4820},{"style":665},[4821],{"type":612,"value":770},{"type":606,"tag":636,"props":4823,"children":4824},{"style":677},[4825],{"type":612,"value":1583},{"type":606,"tag":636,"props":4827,"children":4828},{"style":671},[4829],{"type":612,"value":780},{"type":606,"tag":857,"props":4831,"children":4833},{"id":4832},"binary-operations-reference-table",[4834],{"type":612,"value":4835},"📋 Binary Operations Reference Table",{"type":606,"tag":4837,"props":4838,"children":4839},"table",{},[4840,4864],{"type":606,"tag":4841,"props":4842,"children":4843},"thead",{},[4844],{"type":606,"tag":4845,"props":4846,"children":4847},"tr",{},[4848,4854,4859],{"type":606,"tag":4849,"props":4850,"children":4851},"th",{},[4852],{"type":612,"value":4853},"Operation",{"type":606,"tag":4849,"props":4855,"children":4856},{},[4857],{"type":612,"value":4858},"Method",{"type":606,"tag":4849,"props":4860,"children":4861},{},[4862],{"type":612,"value":4863},"Use Case",{"type":606,"tag":4865,"props":4866,"children":4867},"tbody",{},[4868,4891,4913,4935,4958,4980],{"type":606,"tag":4845,"props":4869,"children":4870},{},[4871,4877,4886],{"type":606,"tag":4872,"props":4873,"children":4874},"td",{},[4875],{"type":612,"value":4876},"Read all",{"type":606,"tag":4872,"props":4878,"children":4879},{},[4880],{"type":606,"tag":632,"props":4881,"children":4883},{"className":4882},[],[4884],{"type":612,"value":4885},"file.read()",{"type":606,"tag":4872,"props":4887,"children":4888},{},[4889],{"type":612,"value":4890},"Small files",{"type":606,"tag":4845,"props":4892,"children":4893},{},[4894,4899,4908],{"type":606,"tag":4872,"props":4895,"children":4896},{},[4897],{"type":612,"value":4898},"Read chunk",{"type":606,"tag":4872,"props":4900,"children":4901},{},[4902],{"type":606,"tag":632,"props":4903,"children":4905},{"className":4904},[],[4906],{"type":612,"value":4907},"file.read(size)",{"type":606,"tag":4872,"props":4909,"children":4910},{},[4911],{"type":612,"value":4912},"Large files",{"type":606,"tag":4845,"props":4914,"children":4915},{},[4916,4921,4930],{"type":606,"tag":4872,"props":4917,"children":4918},{},[4919],{"type":612,"value":4920},"Write all",{"type":606,"tag":4872,"props":4922,"children":4923},{},[4924],{"type":606,"tag":632,"props":4925,"children":4927},{"className":4926},[],[4928],{"type":612,"value":4929},"file.write(data)",{"type":606,"tag":4872,"props":4931,"children":4932},{},[4933],{"type":612,"value":4934},"Complete replacement",{"type":606,"tag":4845,"props":4936,"children":4937},{},[4938,4943,4953],{"type":606,"tag":4872,"props":4939,"children":4940},{},[4941],{"type":612,"value":4942},"Append",{"type":606,"tag":4872,"props":4944,"children":4945},{},[4946,4948],{"type":612,"value":4947},"Mode ",{"type":606,"tag":632,"props":4949,"children":4951},{"className":4950},[],[4952],{"type":612,"value":939},{"type":606,"tag":4872,"props":4954,"children":4955},{},[4956],{"type":612,"value":4957},"Add to existing",{"type":606,"tag":4845,"props":4959,"children":4960},{},[4961,4966,4975],{"type":606,"tag":4872,"props":4962,"children":4963},{},[4964],{"type":612,"value":4965},"Seek",{"type":606,"tag":4872,"props":4967,"children":4968},{},[4969],{"type":606,"tag":632,"props":4970,"children":4972},{"className":4971},[],[4973],{"type":612,"value":4974},"file.seek(pos)",{"type":606,"tag":4872,"props":4976,"children":4977},{},[4978],{"type":612,"value":4979},"Random access",{"type":606,"tag":4845,"props":4981,"children":4982},{},[4983,4988,4997],{"type":606,"tag":4872,"props":4984,"children":4985},{},[4986],{"type":612,"value":4987},"Tell",{"type":606,"tag":4872,"props":4989,"children":4990},{},[4991],{"type":606,"tag":632,"props":4992,"children":4994},{"className":4993},[],[4995],{"type":612,"value":4996},"file.tell()",{"type":606,"tag":4872,"props":4998,"children":4999},{},[5000],{"type":612,"value":5001},"Current position",{"type":606,"tag":857,"props":5003,"children":5005},{"id":5004},"key-takeaways",[5006],{"type":612,"value":5007},"🎯 Key Takeaways",{"type":606,"tag":869,"props":5009,"children":5013},{"emoji":5010,"title":5011,"type":5012},"📚","Binary File Essentials","success",[5014,5022,5059,5067,5102,5110,5133],{"type":606,"tag":615,"props":5015,"children":5016},{},[5017],{"type":606,"tag":879,"props":5018,"children":5019},{},[5020],{"type":612,"value":5021},"Basic Operations:",{"type":606,"tag":885,"props":5023,"children":5024},{},[5025,5044,5049,5054],{"type":606,"tag":889,"props":5026,"children":5027},{},[5028,5030,5035,5037,5042],{"type":612,"value":5029},"Use ",{"type":606,"tag":632,"props":5031,"children":5033},{"className":5032},[],[5034],{"type":612,"value":690},{"type":612,"value":5036}," and ",{"type":606,"tag":632,"props":5038,"children":5040},{"className":5039},[],[5041],{"type":612,"value":825},{"type":612,"value":5043}," modes",{"type":606,"tag":889,"props":5045,"children":5046},{},[5047],{"type":612,"value":5048},"Work with bytes objects",{"type":606,"tag":889,"props":5050,"children":5051},{},[5052],{"type":612,"value":5053},"Read in chunks for large files",{"type":606,"tag":889,"props":5055,"children":5056},{},[5057],{"type":612,"value":5058},"Handle exceptions gracefully",{"type":606,"tag":615,"props":5060,"children":5061},{},[5062],{"type":606,"tag":879,"props":5063,"children":5064},{},[5065],{"type":612,"value":5066},"Advanced Features:",{"type":606,"tag":885,"props":5068,"children":5069},{},[5070,5081,5092,5097],{"type":606,"tag":889,"props":5071,"children":5072},{},[5073,5075],{"type":612,"value":5074},"Structured data with ",{"type":606,"tag":632,"props":5076,"children":5078},{"className":5077},[],[5079],{"type":612,"value":5080},"struct",{"type":606,"tag":889,"props":5082,"children":5083},{},[5084,5086],{"type":612,"value":5085},"Object serialization with ",{"type":606,"tag":632,"props":5087,"children":5089},{"className":5088},[],[5090],{"type":612,"value":5091},"pickle",{"type":606,"tag":889,"props":5093,"children":5094},{},[5095],{"type":612,"value":5096},"File integrity checking",{"type":606,"tag":889,"props":5098,"children":5099},{},[5100],{"type":612,"value":5101},"Binary file comparison",{"type":606,"tag":615,"props":5103,"children":5104},{},[5105],{"type":606,"tag":879,"props":5106,"children":5107},{},[5108],{"type":612,"value":5109},"Best Practices:",{"type":606,"tag":885,"props":5111,"children":5112},{},[5113,5118,5123,5128],{"type":606,"tag":889,"props":5114,"children":5115},{},[5116],{"type":612,"value":5117},"Read large files in chunks",{"type":606,"tag":889,"props":5119,"children":5120},{},[5121],{"type":612,"value":5122},"Validate file integrity",{"type":606,"tag":889,"props":5124,"children":5125},{},[5126],{"type":612,"value":5127},"Handle encoding carefully",{"type":606,"tag":889,"props":5129,"children":5130},{},[5131],{"type":612,"value":5132},"Use appropriate buffer sizes",{"type":606,"tag":615,"props":5134,"children":5135},{},[5136,5141],{"type":606,"tag":879,"props":5137,"children":5138},{},[5139],{"type":612,"value":5140},"Remember:",{"type":612,"value":5142}," Binary files require different handling than text files - no encoding/decoding!",{"type":606,"tag":5144,"props":5145,"children":5146},"style",{},[5147],{"type":612,"value":5148},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .app-dark-mode .shiki span {color: var(--shiki-app-dark-mode);background: var(--shiki-app-dark-mode-bg);font-style: var(--shiki-app-dark-mode-font-style);font-weight: var(--shiki-app-dark-mode-font-weight);text-decoration: var(--shiki-app-dark-mode-text-decoration);}html.app-dark-mode .shiki span {color: var(--shiki-app-dark-mode);background: var(--shiki-app-dark-mode-bg);font-style: var(--shiki-app-dark-mode-font-style);font-weight: var(--shiki-app-dark-mode-font-weight);text-decoration: var(--shiki-app-dark-mode-text-decoration);}",{"title":8,"searchDepth":36,"depth":36,"links":5150},[5151,5157,5163,5164],{"id":859,"depth":27,"text":862,"children":5152},[5153,5154,5155,5156],{"id":982,"depth":36,"text":985},{"id":1323,"depth":36,"text":1326},{"id":1769,"depth":36,"text":1772},{"id":2367,"depth":36,"text":2370},{"id":2762,"depth":27,"text":2765,"children":5158},[5159,5160,5161,5162],{"id":2773,"depth":36,"text":2776},{"id":3136,"depth":36,"text":3139},{"id":3758,"depth":36,"text":3761},{"id":4185,"depth":36,"text":4188},{"id":4832,"depth":27,"text":4835},{"id":5004,"depth":27,"text":5007},1782373757313]