[{"data":1,"prerenderedAt":6847},["ShallowReactive",2],{"tutorials-python":3,"category-items-python":987,"content-/python/file-basics":988},[4,22,31,40,49,58,67,76,86,95,104,113,122,131,141,150,159,168,177,186,196,205,214,223,233,242,251,260,269,279,288,297,306,315,324,333,342,351,360,369,379,388,397,406,415,424,433,442,452,461,470,479,488,497,506,515,525,534,543,552,561,570,579,588,597,606,616,625,634,643,652,661,670,680,689,698,707,716,725,734,744,753,762,771,780,789,798,807,817,826,835,844,853,863,872,881,890,900,909,918,927,936,945,953,961,970,979],{"_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/getting-started","python",false,"","Getting Started","Begin your Python programming journey. Learn what Python is, how to set it up, and write your first programs. Perfect for complete beginners starting their coding adventure.","getting-started",1,true,"pi pi-folder","markdown","content:python:1.getting-started.md","content","python/1.getting-started.md","python/1.getting-started","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/what-is-python","What is Python","Discover Python's fascinating history, design philosophy, and key features. Learn why Python has become one of the world's most popular programming languages and perfect for beginners.","what-is-python",2,"content:python:2.what-is-python.md","python/2.what-is-python.md","python/2.what-is-python",{"_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/setup-python","Setup Python","Learn how to install Python on your computer and set up your development environment. Step-by-step guide for Windows, macOS, and Linux with beginner-friendly instructions.","setup-python",3,"content:python:3.setup-python.md","python/3.setup-python.md","python/3.setup-python",{"_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/your-first-program","Your First Program","Write and run your first Python program! Learn the basics of Python programming with simple examples and step-by-step instructions for beginners.","your-first-program",4,"content:python:4.your-first-program.md","python/4.your-first-program.md","python/4.your-first-program",{"_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/python-code-structure","Python Code Structure","Learn how Python code is organized and structured. Understand indentation, line breaks, and the basic rules that make Python programs work correctly.","python-code-structure",5,"content:python:5.python-code-structure.md","python/5.python-code-structure.md","python/5.python-code-structure",{"_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/writing-comments","Writing Comments","Learn how to write effective comments in Python. Discover when and how to document your code to make it clear, maintainable, and easy to understand.","writing-comments",6,"content:python:6.writing-comments.md","python/6.writing-comments.md","python/6.writing-comments",{"_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/working-with-variables","Working with Variables","Learn how to create, use, and manage variables in Python. Understand how to store data, change values, and follow naming conventions for clean, readable code.","working-with-variables",7,"content:python:7.working-with-variables.md","python/7.working-with-variables.md","python/7.working-with-variables",{"_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/basic-data-types","Basic Data Types","Learn about Python's fundamental data types including numbers, text, and boolean values","basic-data-types",8,"content:python:8.basic-data-types.md","python/8.basic-data-types.md","python/8.basic-data-types",[86,95,104,113,122],{"_path":87,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":88,"description":89,"slug":90,"parentId":77,"order":91,"_type":15,"_id":92,"_source":17,"_file":93,"_stem":94,"_extension":20},"/python/understanding-data-types","Understanding Data Types","Learn how Python identifies different data types and why they're important for programming","understanding-data-types",9,"content:python:9.understanding-data-types.md","python/9.understanding-data-types.md","python/9.understanding-data-types",{"_path":96,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":97,"description":98,"slug":99,"parentId":77,"order":100,"_type":15,"_id":101,"_source":17,"_file":102,"_stem":103,"_extension":20},"/python/working-with-numbers","Working with Numbers","Learn about Python's numeric data types including integers and floats, and how to perform calculations","working-with-numbers",10,"content:python:10.working-with-numbers.md","python/10.working-with-numbers.md","python/10.working-with-numbers",{"_path":105,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":106,"description":107,"slug":108,"parentId":77,"order":109,"_type":15,"_id":110,"_source":17,"_file":111,"_stem":112,"_extension":20},"/python/text-and-strings","Text and Strings","Learn how to work with text data in Python using strings, including creation, manipulation, and formatting","text-and-strings",11,"content:python:11.text-and-strings.md","python/11.text-and-strings.md","python/11.text-and-strings",{"_path":114,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":115,"description":116,"slug":117,"parentId":77,"order":118,"_type":15,"_id":119,"_source":17,"_file":120,"_stem":121,"_extension":20},"/python/true-false-values","True/False Values","Learn about boolean values in Python, including True/False logic, comparison operations, and how to use booleans for decision-making in your programs","true-false-values",12,"content:python:12.true-false-values.md","python/12.true-false-values.md","python/12.true-false-values",{"_path":123,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":124,"description":125,"slug":126,"parentId":77,"order":127,"_type":15,"_id":128,"_source":17,"_file":129,"_stem":130,"_extension":20},"/python/converting-types","Converting Types","Learn how to convert between different Python data types including strings, numbers, and booleans","converting-types",13,"content:python:13.converting-types.md","python/13.converting-types.md","python/13.converting-types",{"_path":132,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":133,"description":134,"slug":135,"order":136,"isParent":13,"icon":14,"_type":15,"_id":137,"_source":17,"_file":138,"_stem":139,"_extension":20,"children":140,"expanded":13},"/python/python-operators","Python Operators","Learn about Python operators - the symbols and keywords that perform operations on data. Discover arithmetic, comparison, logical, and assignment operators with simple examples.","python-operators",14,"content:python:14.python-operators.md","python/14.python-operators.md","python/14.python-operators",[141,150,159,168,177],{"_path":142,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":143,"description":144,"slug":145,"parentId":132,"order":146,"_type":15,"_id":147,"_source":17,"_file":148,"_stem":149,"_extension":20},"/python/math-operations","Math Operations","Learn Python's arithmetic operators for mathematical calculations. Master addition, subtraction, multiplication, division, and more with practical examples.","math-operations",15,"content:python:15.math-operations.md","python/15.math-operations.md","python/15.math-operations",{"_path":151,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":152,"description":153,"slug":154,"parentId":132,"order":155,"_type":15,"_id":156,"_source":17,"_file":157,"_stem":158,"_extension":20},"/python/comparing-values","Comparing Values","Learn Python's comparison operators to compare values and make decisions. Master equality, inequality, and relational operators with practical examples.","comparing-values",16,"content:python:16.comparing-values.md","python/16.comparing-values.md","python/16.comparing-values",{"_path":160,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":161,"description":162,"slug":163,"parentId":132,"order":164,"_type":15,"_id":165,"_source":17,"_file":166,"_stem":167,"_extension":20},"/python/logic-operations","Logic Operations","Learn about Python's logical operators for combining conditions and creating complex boolean expressions","logic-operations",17,"content:python:17.logic-operations.md","python/17.logic-operations.md","python/17.logic-operations",{"_path":169,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":170,"description":171,"slug":172,"parentId":132,"order":173,"_type":15,"_id":174,"_source":17,"_file":175,"_stem":176,"_extension":20},"/python/value-assignment","Value Assignment","Learn about Python's assignment operators for efficiently updating variables and performing calculations","value-assignment",18,"content:python:18.value-assignment.md","python/18.value-assignment.md","python/18.value-assignment",{"_path":178,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":179,"description":180,"slug":181,"parentId":132,"order":182,"_type":15,"_id":183,"_source":17,"_file":184,"_stem":185,"_extension":20},"/python/operator-precedence","Operator Precedence","Learn how Python evaluates expressions with multiple operators and how to control evaluation order","operator-precedence",19,"content:python:19.operator-precedence.md","python/19.operator-precedence.md","python/19.operator-precedence",{"_path":187,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":188,"description":189,"slug":190,"order":191,"isParent":13,"icon":14,"_type":15,"_id":192,"_source":17,"_file":193,"_stem":194,"_extension":20,"children":195,"expanded":13},"/python/decision-making","Decision Making","Learn how to make decisions in your Python programs using conditional statements and control flow","decision-making",20,"content:python:20.decision-making.md","python/20.decision-making.md","python/20.decision-making",[196,205,214],{"_path":197,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":198,"description":199,"slug":200,"parentId":187,"order":201,"_type":15,"_id":202,"_source":17,"_file":203,"_stem":204,"_extension":20},"/python/if-statements","If Statements","Learn how to use if statements to make decisions and control program flow in Python","if-statements",21,"content:python:21.if-statements.md","python/21.if-statements.md","python/21.if-statements",{"_path":206,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":207,"description":208,"slug":209,"parentId":187,"order":210,"_type":15,"_id":211,"_source":17,"_file":212,"_stem":213,"_extension":20},"/python/multiple-conditions","Multiple Conditions","Learn how to handle multiple conditions using elif statements and complex conditional logic in Python","multiple-conditions",22,"content:python:22.multiple-conditions.md","python/22.multiple-conditions.md","python/22.multiple-conditions",{"_path":215,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":216,"description":217,"slug":218,"parentId":187,"order":219,"_type":15,"_id":220,"_source":17,"_file":221,"_stem":222,"_extension":20},"/python/pattern-matching","Pattern Matching","Learn how to use Python's match-case statements for powerful pattern matching and complex decision making","pattern-matching",23,"content:python:23.pattern-matching.md","python/23.pattern-matching.md","python/23.pattern-matching",{"_path":224,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":225,"description":226,"slug":227,"order":228,"isParent":13,"icon":14,"_type":15,"_id":229,"_source":17,"_file":230,"_stem":231,"_extension":20,"children":232,"expanded":13},"/python/repetition-and-loops","Python Loops","Learn how to use loops to repeat code efficiently and handle repetitive tasks in Python","repetition-and-loops",24,"content:python:24.repetition-and-loops.md","python/24.repetition-and-loops.md","python/24.repetition-and-loops",[233,242,251,260],{"_path":234,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":235,"description":236,"slug":237,"parentId":224,"order":238,"_type":15,"_id":239,"_source":17,"_file":240,"_stem":241,"_extension":20},"/python/while-loops","While Loops","Learn how to use while loops for condition-based repetition and create loops that run until specific conditions are met","while-loops",25,"content:python:25.while-loops.md","python/25.while-loops.md","python/25.while-loops",{"_path":243,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":244,"description":245,"slug":246,"parentId":224,"order":247,"_type":15,"_id":248,"_source":17,"_file":249,"_stem":250,"_extension":20},"/python/for-loops","For Loops","Learn how to use for loops to iterate through sequences, collections, and ranges efficiently in Python","for-loops",26,"content:python:26.for-loops.md","python/26.for-loops.md","python/26.for-loops",{"_path":252,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":253,"description":254,"slug":255,"parentId":224,"order":256,"_type":15,"_id":257,"_source":17,"_file":258,"_stem":259,"_extension":20},"/python/loop-control","Loop Control","Master advanced loop control techniques including break, continue, and else clauses for sophisticated iteration patterns","loop-control",27,"content:python:27.loop-control.md","python/27.loop-control.md","python/27.loop-control",{"_path":261,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":262,"description":263,"slug":264,"parentId":224,"order":265,"_type":15,"_id":266,"_source":17,"_file":267,"_stem":268,"_extension":20},"/python/nested-loops","Nested Loops","Learn how to use nested loops to process multi-dimensional data, create patterns, and handle complex iteration scenarios","nested-loops",28,"content:python:28.nested-loops.md","python/28.nested-loops.md","python/28.nested-loops",{"_path":270,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":271,"description":272,"slug":273,"order":274,"isParent":13,"icon":14,"_type":15,"_id":275,"_source":17,"_file":276,"_stem":277,"_extension":20,"children":278,"expanded":13},"/python/python-lists","Python Lists","Learn about Python lists, one of the most important and versatile data structures for storing and organizing collections of data","python-lists",29,"content:python:29.python-lists.md","python/29.python-lists.md","python/29.python-lists",[279,288,297,306,315,324,333,342,351,360],{"_path":280,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":281,"description":282,"slug":283,"parentId":270,"order":284,"_type":15,"_id":285,"_source":17,"_file":286,"_stem":287,"_extension":20},"/python/creating-lists","Creating Lists","Learn different methods to create and initialize Python lists, from simple literals to advanced techniques","creating-lists",30,"content:python:30.creating-lists.md","python/30.creating-lists.md","python/30.creating-lists",{"_path":289,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":290,"description":291,"slug":292,"parentId":270,"order":293,"_type":15,"_id":294,"_source":17,"_file":295,"_stem":296,"_extension":20},"/python/reading-list-data","Reading List Data","Master techniques for accessing and retrieving data from Python lists using indexing, slicing, and built-in methods","reading-list-data",31,"content:python:31.reading-list-data.md","python/31.reading-list-data.md","python/31.reading-list-data",{"_path":298,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":299,"description":300,"slug":301,"parentId":270,"order":302,"_type":15,"_id":303,"_source":17,"_file":304,"_stem":305,"_extension":20},"/python/modifying-lists","Modifying Lists","Learn how to change, update, and modify existing elements in Python lists using indexing and various methods","modifying-lists",32,"content:python:32.modifying-lists.md","python/32.modifying-lists.md","python/32.modifying-lists",{"_path":307,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":308,"description":309,"slug":310,"parentId":270,"order":311,"_type":15,"_id":312,"_source":17,"_file":313,"_stem":314,"_extension":20},"/python/adding-to-lists","Adding to Lists","Learn various methods to add elements to Python lists including append, insert, extend, and concatenation techniques","adding-to-lists",33,"content:python:33.adding-to-lists.md","python/33.adding-to-lists.md","python/33.adding-to-lists",{"_path":316,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":317,"description":318,"slug":319,"parentId":270,"order":320,"_type":15,"_id":321,"_source":17,"_file":322,"_stem":323,"_extension":20},"/python/removing-from-lists","Removing from Lists","Learn different methods to remove and delete elements from Python lists including remove, pop, del, and clear","removing-from-lists",34,"content:python:34.removing-from-lists.md","python/34.removing-from-lists.md","python/34.removing-from-lists",{"_path":325,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":326,"description":327,"slug":328,"parentId":270,"order":329,"_type":15,"_id":330,"_source":17,"_file":331,"_stem":332,"_extension":20},"/python/looping-through-lists","Looping Through Lists","Learn different ways to iterate through Python lists using for loops, while loops, enumerate, and other iteration techniques","looping-through-lists",35,"content:python:35.looping-through-lists.md","python/35.looping-through-lists.md","python/35.looping-through-lists",{"_path":334,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":335,"description":336,"slug":337,"parentId":270,"order":338,"_type":15,"_id":339,"_source":17,"_file":340,"_stem":341,"_extension":20},"/python/list-shortcuts","List Shortcuts","Learn powerful Python list shortcuts including list comprehensions, slicing tricks, and built-in functions for efficient list operations","list-shortcuts",36,"content:python:36.list-shortcuts.md","python/36.list-shortcuts.md","python/36.list-shortcuts",{"_path":343,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":344,"description":345,"slug":346,"parentId":270,"order":347,"_type":15,"_id":348,"_source":17,"_file":349,"_stem":350,"_extension":20},"/python/organizing-lists","Organizing Lists","Learn how to sort, reverse, and organize Python lists using built-in methods and custom sorting techniques","organizing-lists",37,"content:python:37.organizing-lists.md","python/37.organizing-lists.md","python/37.organizing-lists",{"_path":352,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":353,"description":354,"slug":355,"parentId":270,"order":356,"_type":15,"_id":357,"_source":17,"_file":358,"_stem":359,"_extension":20},"/python/combining-lists","Combining Lists","Learn various techniques to combine, merge, and join Python lists including concatenation, zipping, and advanced merging strategies","combining-lists",38,"content:python:38.combining-lists.md","python/38.combining-lists.md","python/38.combining-lists",{"_path":361,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":362,"description":363,"slug":364,"parentId":270,"order":365,"_type":15,"_id":366,"_source":17,"_file":367,"_stem":368,"_extension":20},"/python/essential-list-tools","Essential List Tools","Master powerful built-in functions and advanced techniques for efficient Python list manipulation and data processing","essential-list-tools",39,"content:python:39.essential-list-tools.md","python/39.essential-list-tools.md","python/39.essential-list-tools",{"_path":370,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":371,"description":372,"slug":373,"order":374,"isParent":13,"icon":14,"_type":15,"_id":375,"_source":17,"_file":376,"_stem":377,"_extension":20,"children":378,"expanded":13},"/python/python-tuples","Python Tuples","Master Python tuples - immutable sequences perfect for storing related data that shouldn't change. Learn creation, access, and manipulation techniques.","python-tuples",40,"content:python:40.python-tuples.md","python/40.python-tuples.md","python/40.python-tuples",[379,388,397,406,415,424,433],{"_path":380,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":381,"description":382,"slug":383,"parentId":370,"order":384,"_type":15,"_id":385,"_source":17,"_file":386,"_stem":387,"_extension":20},"/python/creating-tuples","Creating Tuples","Learn different ways to create Python tuples, from basic syntax to advanced techniques. Master tuple initialization and understand when to use tuples.","creating-tuples",41,"content:python:41.creating-tuples.md","python/41.creating-tuples.md","python/41.creating-tuples",{"_path":389,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":390,"description":391,"slug":392,"parentId":370,"order":393,"_type":15,"_id":394,"_source":17,"_file":395,"_stem":396,"_extension":20},"/python/reading-tuple-data","Reading Tuple Data","Master accessing tuple elements through indexing, slicing, and searching. Learn efficient patterns for reading and working with tuple data.","reading-tuple-data",42,"content:python:42.reading-tuple-data.md","python/42.reading-tuple-data.md","python/42.reading-tuple-data",{"_path":398,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":399,"description":400,"slug":401,"parentId":370,"order":402,"_type":15,"_id":403,"_source":17,"_file":404,"_stem":405,"_extension":20},"/python/changing-tuples","Changing Tuples","Understand tuple immutability and learn techniques for working with unchangeable data. Master creating modified tuple versions and handling immutable constraints.","changing-tuples",43,"content:python:43.changing-tuples.md","python/43.changing-tuples.md","python/43.changing-tuples",{"_path":407,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":408,"description":409,"slug":410,"parentId":370,"order":411,"_type":15,"_id":412,"_source":17,"_file":413,"_stem":414,"_extension":20},"/python/tuple-unpacking","Tuple Unpacking","Master tuple unpacking for elegant variable assignment, function returns, and data extraction. Learn Python's powerful unpacking syntax and patterns.","tuple-unpacking",44,"content:python:44.tuple-unpacking.md","python/44.tuple-unpacking.md","python/44.tuple-unpacking",{"_path":416,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":417,"description":418,"slug":419,"parentId":370,"order":420,"_type":15,"_id":421,"_source":17,"_file":422,"_stem":423,"_extension":20},"/python/iterating-tuples","Iterating Tuples","Master tuple iteration techniques for processing sequence data. Learn basic loops, enumerate, nested iteration, and advanced patterns for efficient data processing.","iterating-tuples",45,"content:python:45.iterating-tuples.md","python/45.iterating-tuples.md","python/45.iterating-tuples",{"_path":425,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":426,"description":427,"slug":428,"parentId":370,"order":429,"_type":15,"_id":430,"_source":17,"_file":431,"_stem":432,"_extension":20},"/python/merging-tuples","Merging Tuples","Learn techniques for combining and merging tuples to create larger data structures. Master concatenation, joining multiple tuples, and advanced merging patterns.","merging-tuples",46,"content:python:46.merging-tuples.md","python/46.merging-tuples.md","python/46.merging-tuples",{"_path":434,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":435,"description":436,"slug":437,"parentId":370,"order":438,"_type":15,"_id":439,"_source":17,"_file":440,"_stem":441,"_extension":20},"/python/tuple-operations","Tuple Operations","Master comprehensive tuple operations including built-in functions, mathematical operations, comparisons, and advanced techniques for efficient tuple manipulation.","tuple-operations",47,"content:python:47.tuple-operations.md","python/47.tuple-operations.md","python/47.tuple-operations",{"_path":443,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":444,"description":445,"slug":446,"order":447,"isParent":13,"icon":14,"_type":15,"_id":448,"_source":17,"_file":449,"_stem":450,"_extension":20,"children":451,"expanded":13},"/python/python-sets","Python Sets","Discover Python sets - unique collections that automatically eliminate duplicates and provide powerful mathematical operations for data filtering and analysis.","python-sets",48,"content:python:48.python-sets.md","python/48.python-sets.md","python/48.python-sets",[452,461,470,479,488,497,506],{"_path":453,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":454,"description":455,"slug":456,"parentId":443,"order":457,"_type":15,"_id":458,"_source":17,"_file":459,"_stem":460,"_extension":20},"/python/creating-sets","Creating Sets","Learn multiple ways to create sets in Python including literal syntax, set() function, and set comprehensions. Master set creation from different data sources.","creating-sets",49,"content:python:49.creating-sets.md","python/49.creating-sets.md","python/49.creating-sets",{"_path":462,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":463,"description":464,"slug":465,"parentId":443,"order":466,"_type":15,"_id":467,"_source":17,"_file":468,"_stem":469,"_extension":20},"/python/reading-set-data","Reading Set Data","Learn how to access and examine set data in Python including membership testing, iteration, size checking, and converting sets to other data types.","reading-set-data",50,"content:python:50.reading-set-data.md","python/50.reading-set-data.md","python/50.reading-set-data",{"_path":471,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":472,"description":473,"slug":474,"parentId":443,"order":475,"_type":15,"_id":476,"_source":17,"_file":477,"_stem":478,"_extension":20},"/python/adding-to-sets","Adding to Sets","Learn how to add elements to sets in Python using add(), update(), and union operations. Master growing sets dynamically with single items and multiple elements.","adding-to-sets",51,"content:python:51.adding-to-sets.md","python/51.adding-to-sets.md","python/51.adding-to-sets",{"_path":480,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":481,"description":482,"slug":483,"parentId":443,"order":484,"_type":15,"_id":485,"_source":17,"_file":486,"_stem":487,"_extension":20},"/python/removing-from-sets","Removing from Sets","Learn how to remove elements from Python sets using different methods like remove(), discard(), pop(), and clear()","removing-from-sets",52,"content:python:52.removing-from-sets.md","python/52.removing-from-sets.md","python/52.removing-from-sets",{"_path":489,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":490,"description":491,"slug":492,"parentId":443,"order":493,"_type":15,"_id":494,"_source":17,"_file":495,"_stem":496,"_extension":20},"/python/iterating-sets","Iterating Sets","Learn different ways to iterate through Python sets using for loops, comprehensions, and built-in functions","iterating-sets",53,"content:python:53.iterating-sets.md","python/53.iterating-sets.md","python/53.iterating-sets",{"_path":498,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":499,"description":500,"slug":501,"parentId":443,"order":502,"_type":15,"_id":503,"_source":17,"_file":504,"_stem":505,"_extension":20},"/python/combining-sets","Combining Sets","Learn how to combine Python sets using union, intersection, difference, and other set operations","combining-sets",54,"content:python:54.combining-sets.md","python/54.combining-sets.md","python/54.combining-sets",{"_path":507,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":508,"description":509,"slug":510,"parentId":443,"order":511,"_type":15,"_id":512,"_source":17,"_file":513,"_stem":514,"_extension":20},"/python/set-operations","Set Operations","Learn advanced Python set operations including comparisons, subsets, supersets, and mathematical set relationships","set-operations",55,"content:python:55.set-operations.md","python/55.set-operations.md","python/55.set-operations",{"_path":516,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":517,"description":518,"slug":519,"order":520,"isParent":13,"icon":14,"_type":15,"_id":521,"_source":17,"_file":522,"_stem":523,"_extension":20,"children":524,"expanded":13},"/python/python-dictionaries","Python Dictionaries","Learn about Python dictionaries - key-value data structures for storing and organizing related information","python-dictionaries",56,"content:python:56.python-dictionaries.md","python/56.python-dictionaries.md","python/56.python-dictionaries",[525,534,543,552,561,570,579,588,597],{"_path":526,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":527,"description":528,"slug":529,"parentId":516,"order":530,"_type":15,"_id":531,"_source":17,"_file":532,"_stem":533,"_extension":20},"/python/creating-dictionaries","Creating Dictionaries","Learn different methods to create Python dictionaries using literals, constructors, and comprehensions","creating-dictionaries",57,"content:python:57.creating-dictionaries.md","python/57.creating-dictionaries.md","python/57.creating-dictionaries",{"_path":535,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":536,"description":537,"slug":538,"parentId":516,"order":539,"_type":15,"_id":540,"_source":17,"_file":541,"_stem":542,"_extension":20},"/python/getting-dictionary-values","Getting Dictionary Values","Learn safe and efficient methods to retrieve data from Python dictionaries using various access techniques","getting-dictionary-values",58,"content:python:58.getting-dictionary-values.md","python/58.getting-dictionary-values.md","python/58.getting-dictionary-values",{"_path":544,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":545,"description":546,"slug":547,"parentId":516,"order":548,"_type":15,"_id":549,"_source":17,"_file":550,"_stem":551,"_extension":20},"/python/updating-dictionaries","Updating Dictionaries","Learn how to modify and maintain Python dictionary data using various update methods and techniques","updating-dictionaries",59,"content:python:59.updating-dictionaries.md","python/59.updating-dictionaries.md","python/59.updating-dictionaries",{"_path":553,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":554,"description":555,"slug":556,"parentId":516,"order":557,"_type":15,"_id":558,"_source":17,"_file":559,"_stem":560,"_extension":20},"/python/adding-dictionary-items","Adding Dictionary Items","Learn effective techniques for adding new items to Python dictionaries with various methods and best practices","adding-dictionary-items",60,"content:python:60.adding-dictionary-items.md","python/60.adding-dictionary-items.md","python/60.adding-dictionary-items",{"_path":562,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":563,"description":564,"slug":565,"parentId":516,"order":566,"_type":15,"_id":567,"_source":17,"_file":568,"_stem":569,"_extension":20},"/python/deleting-dictionary-items","Deleting Dictionary Items","Master safe and efficient techniques for removing items from Python dictionaries with various methods and error handling","deleting-dictionary-items",61,"content:python:61.deleting-dictionary-items.md","python/61.deleting-dictionary-items.md","python/61.deleting-dictionary-items",{"_path":571,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":572,"description":573,"slug":574,"parentId":516,"order":575,"_type":15,"_id":576,"_source":17,"_file":577,"_stem":578,"_extension":20},"/python/looping-dictionaries","Looping Dictionaries","Learn efficient techniques for iterating through Python dictionaries using keys, values, and items","looping-dictionaries",62,"content:python:62.looping-dictionaries.md","python/62.looping-dictionaries.md","python/62.looping-dictionaries",{"_path":580,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":581,"description":582,"slug":583,"parentId":516,"order":584,"_type":15,"_id":585,"_source":17,"_file":586,"_stem":587,"_extension":20},"/python/dictionary-copies","Dictionary Copies","Learn safe techniques for duplicating Python dictionaries using shallow and deep copy methods","dictionary-copies",63,"content:python:63.dictionary-copies.md","python/63.dictionary-copies.md","python/63.dictionary-copies",{"_path":589,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":590,"description":591,"slug":592,"parentId":516,"order":593,"_type":15,"_id":594,"_source":17,"_file":595,"_stem":596,"_extension":20},"/python/multi-level-dictionaries","Multi-level Dictionaries","Master working with nested Python dictionaries for complex data structures and hierarchical information","multi-level-dictionaries",64,"content:python:64.multi-level-dictionaries.md","python/64.multi-level-dictionaries.md","python/64.multi-level-dictionaries",{"_path":598,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":599,"description":600,"slug":601,"parentId":516,"order":602,"_type":15,"_id":603,"_source":17,"_file":604,"_stem":605,"_extension":20},"/python/dictionary-tools","Dictionary Tools","Explore powerful built-in functions and advanced techniques for efficient Python dictionary manipulation and analysis","dictionary-tools",65,"content:python:65.dictionary-tools.md","python/65.dictionary-tools.md","python/65.dictionary-tools",{"_path":607,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":608,"description":609,"slug":610,"order":611,"isParent":13,"icon":14,"_type":15,"_id":612,"_source":17,"_file":613,"_stem":614,"_extension":20,"children":615,"expanded":13},"/python/python-functions","Python Functions","Learn how to create and use Python functions to organize code into reusable, modular components that make programs more efficient and maintainable","python-functions",66,"content:python:66.python-functions.md","python/66.python-functions.md","python/66.python-functions",[616,625,634,643,652,661],{"_path":617,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":618,"description":619,"slug":620,"parentId":607,"order":621,"_type":15,"_id":622,"_source":17,"_file":623,"_stem":624,"_extension":20},"/python/function-basics","Function Basics","Learn the fundamentals of creating and using Python functions to organize code into reusable, modular components","function-basics",67,"content:python:67.function-basics.md","python/67.function-basics.md","python/67.function-basics",{"_path":626,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":627,"description":628,"slug":629,"parentId":607,"order":630,"_type":15,"_id":631,"_source":17,"_file":632,"_stem":633,"_extension":20},"/python/function-parameters","Function Parameters","Master different types of Python function parameters including positional, keyword, default, and variable-length arguments","function-parameters",68,"content:python:68.function-parameters.md","python/68.function-parameters.md","python/68.function-parameters",{"_path":635,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":636,"description":637,"slug":638,"parentId":607,"order":639,"_type":15,"_id":640,"_source":17,"_file":641,"_stem":642,"_extension":20},"/python/returning-values","Returning Values","Learn different ways Python functions return data including single values, multiple values, and conditional returns","returning-values",69,"content:python:69.returning-values.md","python/69.returning-values.md","python/69.returning-values",{"_path":644,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":645,"description":646,"slug":647,"parentId":607,"order":648,"_type":15,"_id":649,"_source":17,"_file":650,"_stem":651,"_extension":20},"/python/variable-scope","Variable Scope","Understand Python variable scope including local, global, and nonlocal variables and how they affect function behavior","variable-scope",70,"content:python:70.variable-scope.md","python/70.variable-scope.md","python/70.variable-scope",{"_path":653,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":654,"description":655,"slug":656,"parentId":607,"order":657,"_type":15,"_id":658,"_source":17,"_file":659,"_stem":660,"_extension":20},"/python/anonymous-functions","Anonymous Functions","Learn to create and use Python lambda functions for concise, inline function definitions and functional programming patterns","anonymous-functions",71,"content:python:71.anonymous-functions.md","python/71.anonymous-functions.md","python/71.anonymous-functions",{"_path":662,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":663,"description":664,"slug":665,"parentId":607,"order":666,"_type":15,"_id":667,"_source":17,"_file":668,"_stem":669,"_extension":20},"/python/function-recursion","Function Recursion","Master recursive functions in Python by learning how functions can call themselves to solve complex problems with elegant, mathematical solutions","function-recursion",72,"content:python:72.function-recursion.md","python/72.function-recursion.md","python/72.function-recursion",{"_path":671,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":672,"description":673,"slug":674,"order":675,"isParent":13,"icon":14,"_type":15,"_id":676,"_source":17,"_file":677,"_stem":678,"_extension":20,"children":679,"expanded":13},"/python/object-programming","Object Programming","Learn object-oriented programming (OOP) in Python - create classes, objects, and methods to build organized, reusable code","object-programming",73,"content:python:73.object-programming.md","python/73.object-programming.md","python/73.object-programming",[680,689,698,707,716,725],{"_path":681,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":682,"description":683,"slug":684,"parentId":671,"order":685,"_type":15,"_id":686,"_source":17,"_file":687,"_stem":688,"_extension":20},"/python/classes-and-objects","Classes and Objects","Learn to create Python classes and objects - the foundation of object-oriented programming for building reusable, organized code","classes-and-objects",74,"content:python:74.classes-and-objects.md","python/74.classes-and-objects.md","python/74.classes-and-objects",{"_path":690,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":691,"description":692,"slug":693,"parentId":671,"order":694,"_type":15,"_id":695,"_source":17,"_file":696,"_stem":697,"_extension":20},"/python/object-methods","Object Methods","Master object methods in Python - learn to define behaviors, work with parameters, and create interactive objects that respond to actions","object-methods",75,"content:python:75.object-methods.md","python/75.object-methods.md","python/75.object-methods",{"_path":699,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":700,"description":701,"slug":702,"parentId":671,"order":703,"_type":15,"_id":704,"_source":17,"_file":705,"_stem":706,"_extension":20},"/python/class-inheritance","Class Inheritance","Learn Python class inheritance - create specialized classes that build upon existing functionality while adding new features and behaviors","class-inheritance",76,"content:python:76.class-inheritance.md","python/76.class-inheritance.md","python/76.class-inheritance",{"_path":708,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":709,"description":710,"slug":711,"parentId":671,"order":712,"_type":15,"_id":713,"_source":17,"_file":714,"_stem":715,"_extension":20},"/python/method-overriding","Method Overriding","Master method overriding in Python - learn to customize inherited methods, use super(), and create specialized behaviors while maintaining inheritance benefits","method-overriding",77,"content:python:77.method-overriding.md","python/77.method-overriding.md","python/77.method-overriding",{"_path":717,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":718,"description":719,"slug":720,"parentId":671,"order":721,"_type":15,"_id":722,"_source":17,"_file":723,"_stem":724,"_extension":20},"/python/variable-visibility","Variable Visibility","Master Python variable visibility - learn public, protected, and private attributes to control access and create well-encapsulated classes","variable-visibility",78,"content:python:78.variable-visibility.md","python/78.variable-visibility.md","python/78.variable-visibility",{"_path":726,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":727,"description":728,"slug":729,"parentId":671,"order":730,"_type":15,"_id":731,"_source":17,"_file":732,"_stem":733,"_extension":20},"/python/special-methods","Special Methods","Master Python special methods (magic methods) - learn to implement __str__, __len__, __eq__ and more to make your classes work seamlessly with Python's built-in functions","special-methods",79,"content:python:79.special-methods.md","python/79.special-methods.md","python/79.special-methods",{"_path":735,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":736,"description":737,"slug":738,"order":739,"isParent":13,"icon":14,"_type":15,"_id":740,"_source":17,"_file":741,"_stem":742,"_extension":20,"children":743,"expanded":13},"/python/advanced-concepts","Advanced Concepts","Master advanced Python programming concepts - work with dates, mathematics, JSON data, pattern matching, and more sophisticated programming techniques","advanced-concepts",80,"content:python:80.advanced-concepts.md","python/80.advanced-concepts.md","python/80.advanced-concepts",[744,753,762,771,780,789,798],{"_path":745,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":746,"description":747,"slug":748,"parentId":735,"order":749,"_type":15,"_id":750,"_source":17,"_file":751,"_stem":752,"_extension":20},"/python/working-with-dates","Working with Dates","Master Python date and time handling - work with datetime objects, format dates, calculate durations, and build time-aware applications","working-with-dates",81,"content:python:81.working-with-dates.md","python/81.working-with-dates.md","python/81.working-with-dates",{"_path":754,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":755,"description":756,"slug":757,"parentId":735,"order":758,"_type":15,"_id":759,"_source":17,"_file":760,"_stem":761,"_extension":20},"/python/mathematical-operations","Mathematical Operations","Master Python mathematical computing - use math functions, perform statistical calculations, and implement scientific computing for data analysis and problem-solving","mathematical-operations",82,"content:python:82.mathematical-operations.md","python/82.mathematical-operations.md","python/82.mathematical-operations",{"_path":763,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":764,"description":765,"slug":766,"parentId":735,"order":767,"_type":15,"_id":768,"_source":17,"_file":769,"_stem":770,"_extension":20},"/python/json-data","JSON Data","Master JSON data handling in Python - serialize and deserialize data, work with APIs, manage configuration files, and exchange data between applications","json-data",83,"content:python:83.json-data.md","python/83.json-data.md","python/83.json-data",{"_path":772,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":773,"description":774,"slug":775,"parentId":735,"order":776,"_type":15,"_id":777,"_source":17,"_file":778,"_stem":779,"_extension":20},"/python/package-management","Package Management","Master Python package management with pip and virtual environments - install libraries, manage dependencies, create isolated environments, and distribute packages professionally","package-management",85,"content:python:85.package-management.md","python/85.package-management.md","python/85.package-management",{"_path":781,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":782,"description":783,"slug":784,"parentId":735,"order":785,"_type":15,"_id":786,"_source":17,"_file":787,"_stem":788,"_extension":20},"/python/error-handling","Error Handling","Master Python error handling with try/except blocks, exception types, custom exceptions, debugging techniques, and best practices for robust application development","error-handling",86,"content:python:86.error-handling.md","python/86.error-handling.md","python/86.error-handling",{"_path":790,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":791,"description":792,"slug":793,"parentId":735,"order":794,"_type":15,"_id":795,"_source":17,"_file":796,"_stem":797,"_extension":20},"/python/getting-user-input","Getting User Input","Master user input handling in Python with input validation, data type conversion, interactive programs, and command-line interfaces for engaging user experiences","getting-user-input",87,"content:python:87.getting-user-input.md","python/87.getting-user-input.md","python/87.getting-user-input",{"_path":799,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":800,"description":801,"slug":802,"parentId":735,"order":803,"_type":15,"_id":804,"_source":17,"_file":805,"_stem":806,"_extension":20},"/python/text-formatting","Text Formatting","Master Python text formatting with f-strings, format methods, alignment, number formatting, and advanced techniques for professional, readable output","text-formatting",88,"content:python:88.text-formatting.md","python/88.text-formatting.md","python/88.text-formatting",{"_path":808,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":809,"description":810,"slug":811,"order":812,"isParent":13,"icon":14,"_type":15,"_id":813,"_source":17,"_file":814,"_stem":815,"_extension":20,"children":816,"expanded":13},"/python/file-operations","File Operations","Master Python file handling with reading, writing, and managing files for data persistence and real-world applications","file-operations",89,"content:python:89.file-operations.md","python/89.file-operations.md","python/89.file-operations",[817,826,835,844],{"_path":818,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":819,"description":820,"slug":821,"parentId":808,"order":822,"_type":15,"_id":823,"_source":17,"_file":824,"_stem":825,"_extension":20},"/python/file-basics","File Basics","Learn fundamental Python file operations including opening files, understanding file modes, using context managers, and basic file handling concepts","file-basics",90,"content:python:90.file-basics.md","python/90.file-basics.md","python/90.file-basics",{"_path":827,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":828,"description":829,"slug":830,"parentId":808,"order":831,"_type":15,"_id":832,"_source":17,"_file":833,"_stem":834,"_extension":20},"/python/reading-files","Reading Files","Master Python file reading techniques including reading entire files, line-by-line processing, and handling different file formats for efficient data processing","reading-files",91,"content:python:91.reading-files.md","python/91.reading-files.md","python/91.reading-files",{"_path":836,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":837,"description":838,"slug":839,"parentId":808,"order":840,"_type":15,"_id":841,"_source":17,"_file":842,"_stem":843,"_extension":20},"/python/writing-files","Writing Files","Learn Python file writing techniques including creating new files, appending content, updating existing files, and saving different data formats safely","writing-files",92,"content:python:92.writing-files.md","python/92.writing-files.md","python/92.writing-files",{"_path":845,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":846,"description":847,"slug":848,"parentId":808,"order":849,"_type":15,"_id":850,"_source":17,"_file":851,"_stem":852,"_extension":20},"/python/file-management","File Management","Learn Python file management techniques including checking file properties, organizing files, directory operations, and implementing file system maintenance tasks","file-management",93,"content:python:93.file-management.md","python/93.file-management.md","python/93.file-management",{"_path":854,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":855,"description":856,"slug":857,"order":858,"isParent":13,"icon":14,"_type":15,"_id":859,"_source":17,"_file":860,"_stem":861,"_extension":20,"children":862},"/python/code-organization","Code Organization","Master Python code organization with modules, built-in libraries, and path management for creating maintainable and reusable applications","code-organization",94,"content:python:94.code-organization.md","python/94.code-organization.md","python/94.code-organization",[863,872,881],{"_path":864,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":865,"description":866,"slug":867,"parentId":854,"order":868,"_type":15,"_id":869,"_source":17,"_file":870,"_stem":871,"_extension":20},"/python/creating-modules","Creating Modules","Learn how to create custom Python modules, organize functions and classes, write reusable code components, and design effective module structures","creating-modules",95,"content:python:95.creating-modules.md","python/95.creating-modules.md","python/95.creating-modules",{"_path":873,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":874,"description":875,"slug":876,"parentId":854,"order":877,"_type":15,"_id":878,"_source":17,"_file":879,"_stem":880,"_extension":20},"/python/using-built-in-modules","Using Built-in Modules","Discover Python's extensive standard library and learn to effectively use built-in modules for common programming tasks, data processing, and system operations","using-built-in-modules",96,"content:python:96.using-built-in-modules.md","python/96.using-built-in-modules.md","python/96.using-built-in-modules",{"_path":882,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":883,"description":884,"slug":885,"parentId":854,"order":886,"_type":15,"_id":887,"_source":17,"_file":888,"_stem":889,"_extension":20},"/python/module-paths","Module Paths","Understand Python's module search system, manage import paths, work with packages, and organize larger projects with proper module path management","module-paths",97,"content:python:97.module-paths.md","python/97.module-paths.md","python/97.module-paths",{"_path":891,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":892,"description":893,"slug":894,"order":895,"isParent":13,"icon":14,"_type":15,"_id":896,"_source":17,"_file":897,"_stem":898,"_extension":20,"children":899,"expanded":13},"/python/reference-materials","Reference Materials","Comprehensive Python reference materials including reserved words, built-in functions, and operation guides for quick lookup and development support","reference-materials",98,"content:python:98.reference-materials.md","python/98.reference-materials.md","python/98.reference-materials",[900,909,918,927,936,945,953,961,970],{"_path":901,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":902,"description":903,"slug":904,"parentId":891,"order":905,"_type":15,"_id":906,"_source":17,"_file":907,"_stem":908,"_extension":20},"/python/reserved-words","Reserved Words","Complete reference of Python keywords and reserved words with descriptions, usage examples, and syntax guidelines","reserved-words",99,"content:python:99.reserved-words.md","python/99.reserved-words.md","python/99.reserved-words",{"_path":910,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":911,"description":912,"slug":913,"parentId":891,"order":914,"_type":15,"_id":915,"_source":17,"_file":916,"_stem":917,"_extension":20},"/python/built-in-functions","Built-in Functions","Comprehensive reference of Python's built-in functions with parameters, return values, and practical usage examples","built-in-functions",100,"content:python:100.built-in-functions.md","python/100.built-in-functions.md","python/100.built-in-functions",{"_path":919,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":920,"description":921,"slug":922,"parentId":891,"order":923,"_type":15,"_id":924,"_source":17,"_file":925,"_stem":926,"_extension":20},"/python/string-operations","String Operations","Complete reference of Python string methods, operations, and formatting techniques with examples and use cases","string-operations",101,"content:python:101.string-operations.md","python/101.string-operations.md","python/101.string-operations",{"_path":928,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":929,"description":930,"slug":931,"parentId":891,"order":932,"_type":15,"_id":933,"_source":17,"_file":934,"_stem":935,"_extension":20},"/python/list-operations","List Operations","Complete reference of Python list methods, operations, and manipulation techniques with examples and performance notes","list-operations",102,"content:python:102.list-operations.md","python/102.list-operations.md","python/102.list-operations",{"_path":937,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":938,"description":939,"slug":940,"parentId":891,"order":941,"_type":15,"_id":942,"_source":17,"_file":943,"_stem":944,"_extension":20},"/python/dictionary-operations","Dictionary Operations","Complete reference of Python dictionary methods, operations, and manipulation techniques with examples and use cases","dictionary-operations",103,"content:python:103.dictionary-operations.md","python/103.dictionary-operations.md","python/103.dictionary-operations",{"_path":946,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":435,"description":947,"slug":948,"parentId":891,"order":949,"_type":15,"_id":950,"_source":17,"_file":951,"_stem":952,"_extension":20},"/python/tuple-methods","Complete reference of Python tuple operations, methods, and techniques with examples and use cases","tuple-methods",104,"content:python:104.tuple-methods.md","python/104.tuple-methods.md","python/104.tuple-methods",{"_path":954,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":508,"description":955,"slug":956,"parentId":891,"order":957,"_type":15,"_id":958,"_source":17,"_file":959,"_stem":960,"_extension":20},"/python/set-methods","Complete reference of Python set operations, methods, and mathematical set operations with examples and use cases","set-methods",105,"content:python:105.set-methods.md","python/105.set-methods.md","python/105.set-methods",{"_path":962,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":963,"description":964,"slug":965,"parentId":891,"order":966,"_type":15,"_id":967,"_source":17,"_file":968,"_stem":969,"_extension":20},"/python/file-operations-reference","File Operations Reference","Complete reference of Python file operations, modes, methods, and file handling techniques with examples","file-operations-reference",106,"content:python:106.file-operations-reference.md","python/106.file-operations-reference.md","python/106.file-operations-reference",{"_path":971,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":972,"description":973,"slug":974,"parentId":891,"order":975,"_type":15,"_id":976,"_source":17,"_file":977,"_stem":978,"_extension":20},"/python/error-types","Error Types","Complete reference of Python exception types, error handling patterns, and debugging techniques with examples","error-types",107,"content:python:107.error-types.md","python/107.error-types.md","python/107.error-types",{"_path":980,"_dir":8,"_draft":7,"_partial":7,"_locale":8,"title":981,"description":10,"slug":982,"order":983,"icon":14,"_type":15,"_id":984,"_source":17,"_file":985,"_stem":986,"_extension":20},"/python","Introduction","python-tutorial",0,"content:python:index.md","python/index.md","python/index",[817],{"_path":818,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":819,"description":820,"slug":821,"parentId":808,"order":822,"body":989,"_type":15,"_id":823,"_source":17,"_file":824,"_stem":825,"_extension":20},{"type":990,"children":991,"toc":6836},"root",[992,1000,1006,1011,1829,1836,1841,2132,2139,2144,2744,2750,2755,3580,3586,3591,4771,4777,4782,6338,6475,6481,6486,6772,6777,6790,6796,6801,6808,6814,6819,6830],{"type":993,"tag":994,"props":995,"children":996},"element","h1",{"id":821},[997],{"type":998,"value":999},"text","📄 File Basics",{"type":993,"tag":1001,"props":1002,"children":1003},"p",{},[1004],{"type":998,"value":1005},"File basics in Python introduce you to the fundamental concepts of working with files on your computer. Understanding how to open, close, and interact with files safely is the foundation for all file operations in your programs.",{"type":993,"tag":1001,"props":1007,"children":1008},{},[1009],{"type":998,"value":1010},"Think of files as containers for information that persist even after your program ends - learning to work with them properly ensures your data stays safe and accessible.",{"type":993,"tag":1012,"props":1013,"children":1014},"code-try",{},[1015],{"type":993,"tag":1016,"props":1017,"children":1020},"pre",{"className":1018,"code":1019,"language":6,"meta":8,"style":8},"language-python shiki shiki-themes github-light github-dark","# Basic file opening and closing\n# Opening a file\nfile = open(\"example.txt\", \"w\")\nfile.write(\"Hello, World!\")\nfile.close()  # Important: Always close files\n\n# Reading the file we just created\nfile = open(\"example.txt\", \"r\")\ncontent = file.read()\nprint(f\"File content: {content}\")\nfile.close()\n\n# Context manager - automatically closes files (RECOMMENDED)\nwith open(\"greetings.txt\", \"w\") as file:\n    file.write(\"Hello from Python!\")\n    file.write(\"\\nThis file will be closed automatically.\")\n\n# File is automatically closed here\nprint(\"File operations completed safely\")\n\n# Reading with context manager\nwith open(\"greetings.txt\", \"r\") as file:\n    content = file.read()\n    print(f\"Content: {content}\")\n\n# Demonstrate different file modes\nfilename = \"modes_demo.txt\"\n\n# Write mode - creates new file or overwrites existing\nwith open(filename, \"w\") as file:\n    file.write(\"Original content\\n\")\n\n# Append mode - adds to end of existing file\nwith open(filename, \"a\") as file:\n    file.write(\"Additional content\\n\")\n\n# Read mode - reads file content\nwith open(filename, \"r\") as file:\n    content = file.read()\n    print(f\"Final content:\\n{content}\")\n",[1021],{"type":993,"tag":1022,"props":1023,"children":1024},"code",{"__ignoreMap":8},[1025,1036,1044,1092,1113,1130,1138,1146,1182,1205,1250,1262,1269,1277,1325,1346,1375,1382,1390,1410,1417,1425,1468,1488,1529,1536,1544,1561,1568,1576,1612,1640,1647,1655,1691,1719,1726,1734,1769,1788],{"type":993,"tag":1026,"props":1027,"children":1029},"span",{"class":1028,"line":12},"line",[1030],{"type":993,"tag":1026,"props":1031,"children":1033},{"style":1032},"--shiki-default:#6A737D;--shiki-app-dark-mode:#6A737D",[1034],{"type":998,"value":1035},"# Basic file opening and closing\n",{"type":993,"tag":1026,"props":1037,"children":1038},{"class":1028,"line":27},[1039],{"type":993,"tag":1026,"props":1040,"children":1041},{"style":1032},[1042],{"type":998,"value":1043},"# Opening a file\n",{"type":993,"tag":1026,"props":1045,"children":1046},{"class":1028,"line":36},[1047,1053,1059,1065,1071,1077,1082,1087],{"type":993,"tag":1026,"props":1048,"children":1050},{"style":1049},"--shiki-default:#E36209;--shiki-app-dark-mode:#FFAB70",[1051],{"type":998,"value":1052},"file",{"type":993,"tag":1026,"props":1054,"children":1056},{"style":1055},"--shiki-default:#D73A49;--shiki-app-dark-mode:#F97583",[1057],{"type":998,"value":1058}," =",{"type":993,"tag":1026,"props":1060,"children":1062},{"style":1061},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[1063],{"type":998,"value":1064}," open",{"type":993,"tag":1026,"props":1066,"children":1068},{"style":1067},"--shiki-default:#24292E;--shiki-app-dark-mode:#E1E4E8",[1069],{"type":998,"value":1070},"(",{"type":993,"tag":1026,"props":1072,"children":1074},{"style":1073},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[1075],{"type":998,"value":1076},"\"example.txt\"",{"type":993,"tag":1026,"props":1078,"children":1079},{"style":1067},[1080],{"type":998,"value":1081},", ",{"type":993,"tag":1026,"props":1083,"children":1084},{"style":1073},[1085],{"type":998,"value":1086},"\"w\"",{"type":993,"tag":1026,"props":1088,"children":1089},{"style":1067},[1090],{"type":998,"value":1091},")\n",{"type":993,"tag":1026,"props":1093,"children":1094},{"class":1028,"line":45},[1095,1099,1104,1109],{"type":993,"tag":1026,"props":1096,"children":1097},{"style":1049},[1098],{"type":998,"value":1052},{"type":993,"tag":1026,"props":1100,"children":1101},{"style":1067},[1102],{"type":998,"value":1103},".write(",{"type":993,"tag":1026,"props":1105,"children":1106},{"style":1073},[1107],{"type":998,"value":1108},"\"Hello, World!\"",{"type":993,"tag":1026,"props":1110,"children":1111},{"style":1067},[1112],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1114,"children":1115},{"class":1028,"line":54},[1116,1120,1125],{"type":993,"tag":1026,"props":1117,"children":1118},{"style":1049},[1119],{"type":998,"value":1052},{"type":993,"tag":1026,"props":1121,"children":1122},{"style":1067},[1123],{"type":998,"value":1124},".close()  ",{"type":993,"tag":1026,"props":1126,"children":1127},{"style":1032},[1128],{"type":998,"value":1129},"# Important: Always close files\n",{"type":993,"tag":1026,"props":1131,"children":1132},{"class":1028,"line":63},[1133],{"type":993,"tag":1026,"props":1134,"children":1135},{"emptyLinePlaceholder":13},[1136],{"type":998,"value":1137},"\n",{"type":993,"tag":1026,"props":1139,"children":1140},{"class":1028,"line":72},[1141],{"type":993,"tag":1026,"props":1142,"children":1143},{"style":1032},[1144],{"type":998,"value":1145},"# Reading the file we just created\n",{"type":993,"tag":1026,"props":1147,"children":1148},{"class":1028,"line":81},[1149,1153,1157,1161,1165,1169,1173,1178],{"type":993,"tag":1026,"props":1150,"children":1151},{"style":1049},[1152],{"type":998,"value":1052},{"type":993,"tag":1026,"props":1154,"children":1155},{"style":1055},[1156],{"type":998,"value":1058},{"type":993,"tag":1026,"props":1158,"children":1159},{"style":1061},[1160],{"type":998,"value":1064},{"type":993,"tag":1026,"props":1162,"children":1163},{"style":1067},[1164],{"type":998,"value":1070},{"type":993,"tag":1026,"props":1166,"children":1167},{"style":1073},[1168],{"type":998,"value":1076},{"type":993,"tag":1026,"props":1170,"children":1171},{"style":1067},[1172],{"type":998,"value":1081},{"type":993,"tag":1026,"props":1174,"children":1175},{"style":1073},[1176],{"type":998,"value":1177},"\"r\"",{"type":993,"tag":1026,"props":1179,"children":1180},{"style":1067},[1181],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1183,"children":1184},{"class":1028,"line":91},[1185,1190,1195,1200],{"type":993,"tag":1026,"props":1186,"children":1187},{"style":1067},[1188],{"type":998,"value":1189},"content ",{"type":993,"tag":1026,"props":1191,"children":1192},{"style":1055},[1193],{"type":998,"value":1194},"=",{"type":993,"tag":1026,"props":1196,"children":1197},{"style":1049},[1198],{"type":998,"value":1199}," file",{"type":993,"tag":1026,"props":1201,"children":1202},{"style":1067},[1203],{"type":998,"value":1204},".read()\n",{"type":993,"tag":1026,"props":1206,"children":1207},{"class":1028,"line":100},[1208,1213,1217,1222,1227,1232,1236,1241,1246],{"type":993,"tag":1026,"props":1209,"children":1210},{"style":1061},[1211],{"type":998,"value":1212},"print",{"type":993,"tag":1026,"props":1214,"children":1215},{"style":1067},[1216],{"type":998,"value":1070},{"type":993,"tag":1026,"props":1218,"children":1219},{"style":1055},[1220],{"type":998,"value":1221},"f",{"type":993,"tag":1026,"props":1223,"children":1224},{"style":1073},[1225],{"type":998,"value":1226},"\"File content: ",{"type":993,"tag":1026,"props":1228,"children":1229},{"style":1061},[1230],{"type":998,"value":1231},"{",{"type":993,"tag":1026,"props":1233,"children":1234},{"style":1067},[1235],{"type":998,"value":17},{"type":993,"tag":1026,"props":1237,"children":1238},{"style":1061},[1239],{"type":998,"value":1240},"}",{"type":993,"tag":1026,"props":1242,"children":1243},{"style":1073},[1244],{"type":998,"value":1245},"\"",{"type":993,"tag":1026,"props":1247,"children":1248},{"style":1067},[1249],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1251,"children":1252},{"class":1028,"line":109},[1253,1257],{"type":993,"tag":1026,"props":1254,"children":1255},{"style":1049},[1256],{"type":998,"value":1052},{"type":993,"tag":1026,"props":1258,"children":1259},{"style":1067},[1260],{"type":998,"value":1261},".close()\n",{"type":993,"tag":1026,"props":1263,"children":1264},{"class":1028,"line":118},[1265],{"type":993,"tag":1026,"props":1266,"children":1267},{"emptyLinePlaceholder":13},[1268],{"type":998,"value":1137},{"type":993,"tag":1026,"props":1270,"children":1271},{"class":1028,"line":127},[1272],{"type":993,"tag":1026,"props":1273,"children":1274},{"style":1032},[1275],{"type":998,"value":1276},"# Context manager - automatically closes files (RECOMMENDED)\n",{"type":993,"tag":1026,"props":1278,"children":1279},{"class":1028,"line":136},[1280,1285,1289,1293,1298,1302,1306,1311,1316,1320],{"type":993,"tag":1026,"props":1281,"children":1282},{"style":1055},[1283],{"type":998,"value":1284},"with",{"type":993,"tag":1026,"props":1286,"children":1287},{"style":1061},[1288],{"type":998,"value":1064},{"type":993,"tag":1026,"props":1290,"children":1291},{"style":1067},[1292],{"type":998,"value":1070},{"type":993,"tag":1026,"props":1294,"children":1295},{"style":1073},[1296],{"type":998,"value":1297},"\"greetings.txt\"",{"type":993,"tag":1026,"props":1299,"children":1300},{"style":1067},[1301],{"type":998,"value":1081},{"type":993,"tag":1026,"props":1303,"children":1304},{"style":1073},[1305],{"type":998,"value":1086},{"type":993,"tag":1026,"props":1307,"children":1308},{"style":1067},[1309],{"type":998,"value":1310},") ",{"type":993,"tag":1026,"props":1312,"children":1313},{"style":1055},[1314],{"type":998,"value":1315},"as",{"type":993,"tag":1026,"props":1317,"children":1318},{"style":1049},[1319],{"type":998,"value":1199},{"type":993,"tag":1026,"props":1321,"children":1322},{"style":1067},[1323],{"type":998,"value":1324},":\n",{"type":993,"tag":1026,"props":1326,"children":1327},{"class":1028,"line":146},[1328,1333,1337,1342],{"type":993,"tag":1026,"props":1329,"children":1330},{"style":1049},[1331],{"type":998,"value":1332},"    file",{"type":993,"tag":1026,"props":1334,"children":1335},{"style":1067},[1336],{"type":998,"value":1103},{"type":993,"tag":1026,"props":1338,"children":1339},{"style":1073},[1340],{"type":998,"value":1341},"\"Hello from Python!\"",{"type":993,"tag":1026,"props":1343,"children":1344},{"style":1067},[1345],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1347,"children":1348},{"class":1028,"line":155},[1349,1353,1357,1361,1366,1371],{"type":993,"tag":1026,"props":1350,"children":1351},{"style":1049},[1352],{"type":998,"value":1332},{"type":993,"tag":1026,"props":1354,"children":1355},{"style":1067},[1356],{"type":998,"value":1103},{"type":993,"tag":1026,"props":1358,"children":1359},{"style":1073},[1360],{"type":998,"value":1245},{"type":993,"tag":1026,"props":1362,"children":1363},{"style":1061},[1364],{"type":998,"value":1365},"\\n",{"type":993,"tag":1026,"props":1367,"children":1368},{"style":1073},[1369],{"type":998,"value":1370},"This file will be closed automatically.\"",{"type":993,"tag":1026,"props":1372,"children":1373},{"style":1067},[1374],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1376,"children":1377},{"class":1028,"line":164},[1378],{"type":993,"tag":1026,"props":1379,"children":1380},{"emptyLinePlaceholder":13},[1381],{"type":998,"value":1137},{"type":993,"tag":1026,"props":1383,"children":1384},{"class":1028,"line":173},[1385],{"type":993,"tag":1026,"props":1386,"children":1387},{"style":1032},[1388],{"type":998,"value":1389},"# File is automatically closed here\n",{"type":993,"tag":1026,"props":1391,"children":1392},{"class":1028,"line":182},[1393,1397,1401,1406],{"type":993,"tag":1026,"props":1394,"children":1395},{"style":1061},[1396],{"type":998,"value":1212},{"type":993,"tag":1026,"props":1398,"children":1399},{"style":1067},[1400],{"type":998,"value":1070},{"type":993,"tag":1026,"props":1402,"children":1403},{"style":1073},[1404],{"type":998,"value":1405},"\"File operations completed safely\"",{"type":993,"tag":1026,"props":1407,"children":1408},{"style":1067},[1409],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1411,"children":1412},{"class":1028,"line":191},[1413],{"type":993,"tag":1026,"props":1414,"children":1415},{"emptyLinePlaceholder":13},[1416],{"type":998,"value":1137},{"type":993,"tag":1026,"props":1418,"children":1419},{"class":1028,"line":201},[1420],{"type":993,"tag":1026,"props":1421,"children":1422},{"style":1032},[1423],{"type":998,"value":1424},"# Reading with context manager\n",{"type":993,"tag":1026,"props":1426,"children":1427},{"class":1028,"line":210},[1428,1432,1436,1440,1444,1448,1452,1456,1460,1464],{"type":993,"tag":1026,"props":1429,"children":1430},{"style":1055},[1431],{"type":998,"value":1284},{"type":993,"tag":1026,"props":1433,"children":1434},{"style":1061},[1435],{"type":998,"value":1064},{"type":993,"tag":1026,"props":1437,"children":1438},{"style":1067},[1439],{"type":998,"value":1070},{"type":993,"tag":1026,"props":1441,"children":1442},{"style":1073},[1443],{"type":998,"value":1297},{"type":993,"tag":1026,"props":1445,"children":1446},{"style":1067},[1447],{"type":998,"value":1081},{"type":993,"tag":1026,"props":1449,"children":1450},{"style":1073},[1451],{"type":998,"value":1177},{"type":993,"tag":1026,"props":1453,"children":1454},{"style":1067},[1455],{"type":998,"value":1310},{"type":993,"tag":1026,"props":1457,"children":1458},{"style":1055},[1459],{"type":998,"value":1315},{"type":993,"tag":1026,"props":1461,"children":1462},{"style":1049},[1463],{"type":998,"value":1199},{"type":993,"tag":1026,"props":1465,"children":1466},{"style":1067},[1467],{"type":998,"value":1324},{"type":993,"tag":1026,"props":1469,"children":1470},{"class":1028,"line":219},[1471,1476,1480,1484],{"type":993,"tag":1026,"props":1472,"children":1473},{"style":1067},[1474],{"type":998,"value":1475},"    content ",{"type":993,"tag":1026,"props":1477,"children":1478},{"style":1055},[1479],{"type":998,"value":1194},{"type":993,"tag":1026,"props":1481,"children":1482},{"style":1049},[1483],{"type":998,"value":1199},{"type":993,"tag":1026,"props":1485,"children":1486},{"style":1067},[1487],{"type":998,"value":1204},{"type":993,"tag":1026,"props":1489,"children":1490},{"class":1028,"line":228},[1491,1496,1500,1504,1509,1513,1517,1521,1525],{"type":993,"tag":1026,"props":1492,"children":1493},{"style":1061},[1494],{"type":998,"value":1495},"    print",{"type":993,"tag":1026,"props":1497,"children":1498},{"style":1067},[1499],{"type":998,"value":1070},{"type":993,"tag":1026,"props":1501,"children":1502},{"style":1055},[1503],{"type":998,"value":1221},{"type":993,"tag":1026,"props":1505,"children":1506},{"style":1073},[1507],{"type":998,"value":1508},"\"Content: ",{"type":993,"tag":1026,"props":1510,"children":1511},{"style":1061},[1512],{"type":998,"value":1231},{"type":993,"tag":1026,"props":1514,"children":1515},{"style":1067},[1516],{"type":998,"value":17},{"type":993,"tag":1026,"props":1518,"children":1519},{"style":1061},[1520],{"type":998,"value":1240},{"type":993,"tag":1026,"props":1522,"children":1523},{"style":1073},[1524],{"type":998,"value":1245},{"type":993,"tag":1026,"props":1526,"children":1527},{"style":1067},[1528],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1530,"children":1531},{"class":1028,"line":238},[1532],{"type":993,"tag":1026,"props":1533,"children":1534},{"emptyLinePlaceholder":13},[1535],{"type":998,"value":1137},{"type":993,"tag":1026,"props":1537,"children":1538},{"class":1028,"line":247},[1539],{"type":993,"tag":1026,"props":1540,"children":1541},{"style":1032},[1542],{"type":998,"value":1543},"# Demonstrate different file modes\n",{"type":993,"tag":1026,"props":1545,"children":1546},{"class":1028,"line":256},[1547,1552,1556],{"type":993,"tag":1026,"props":1548,"children":1549},{"style":1067},[1550],{"type":998,"value":1551},"filename ",{"type":993,"tag":1026,"props":1553,"children":1554},{"style":1055},[1555],{"type":998,"value":1194},{"type":993,"tag":1026,"props":1557,"children":1558},{"style":1073},[1559],{"type":998,"value":1560}," \"modes_demo.txt\"\n",{"type":993,"tag":1026,"props":1562,"children":1563},{"class":1028,"line":265},[1564],{"type":993,"tag":1026,"props":1565,"children":1566},{"emptyLinePlaceholder":13},[1567],{"type":998,"value":1137},{"type":993,"tag":1026,"props":1569,"children":1570},{"class":1028,"line":274},[1571],{"type":993,"tag":1026,"props":1572,"children":1573},{"style":1032},[1574],{"type":998,"value":1575},"# Write mode - creates new file or overwrites existing\n",{"type":993,"tag":1026,"props":1577,"children":1578},{"class":1028,"line":284},[1579,1583,1587,1592,1596,1600,1604,1608],{"type":993,"tag":1026,"props":1580,"children":1581},{"style":1055},[1582],{"type":998,"value":1284},{"type":993,"tag":1026,"props":1584,"children":1585},{"style":1061},[1586],{"type":998,"value":1064},{"type":993,"tag":1026,"props":1588,"children":1589},{"style":1067},[1590],{"type":998,"value":1591},"(filename, ",{"type":993,"tag":1026,"props":1593,"children":1594},{"style":1073},[1595],{"type":998,"value":1086},{"type":993,"tag":1026,"props":1597,"children":1598},{"style":1067},[1599],{"type":998,"value":1310},{"type":993,"tag":1026,"props":1601,"children":1602},{"style":1055},[1603],{"type":998,"value":1315},{"type":993,"tag":1026,"props":1605,"children":1606},{"style":1049},[1607],{"type":998,"value":1199},{"type":993,"tag":1026,"props":1609,"children":1610},{"style":1067},[1611],{"type":998,"value":1324},{"type":993,"tag":1026,"props":1613,"children":1614},{"class":1028,"line":293},[1615,1619,1623,1628,1632,1636],{"type":993,"tag":1026,"props":1616,"children":1617},{"style":1049},[1618],{"type":998,"value":1332},{"type":993,"tag":1026,"props":1620,"children":1621},{"style":1067},[1622],{"type":998,"value":1103},{"type":993,"tag":1026,"props":1624,"children":1625},{"style":1073},[1626],{"type":998,"value":1627},"\"Original content",{"type":993,"tag":1026,"props":1629,"children":1630},{"style":1061},[1631],{"type":998,"value":1365},{"type":993,"tag":1026,"props":1633,"children":1634},{"style":1073},[1635],{"type":998,"value":1245},{"type":993,"tag":1026,"props":1637,"children":1638},{"style":1067},[1639],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1641,"children":1642},{"class":1028,"line":302},[1643],{"type":993,"tag":1026,"props":1644,"children":1645},{"emptyLinePlaceholder":13},[1646],{"type":998,"value":1137},{"type":993,"tag":1026,"props":1648,"children":1649},{"class":1028,"line":311},[1650],{"type":993,"tag":1026,"props":1651,"children":1652},{"style":1032},[1653],{"type":998,"value":1654},"# Append mode - adds to end of existing file\n",{"type":993,"tag":1026,"props":1656,"children":1657},{"class":1028,"line":320},[1658,1662,1666,1670,1675,1679,1683,1687],{"type":993,"tag":1026,"props":1659,"children":1660},{"style":1055},[1661],{"type":998,"value":1284},{"type":993,"tag":1026,"props":1663,"children":1664},{"style":1061},[1665],{"type":998,"value":1064},{"type":993,"tag":1026,"props":1667,"children":1668},{"style":1067},[1669],{"type":998,"value":1591},{"type":993,"tag":1026,"props":1671,"children":1672},{"style":1073},[1673],{"type":998,"value":1674},"\"a\"",{"type":993,"tag":1026,"props":1676,"children":1677},{"style":1067},[1678],{"type":998,"value":1310},{"type":993,"tag":1026,"props":1680,"children":1681},{"style":1055},[1682],{"type":998,"value":1315},{"type":993,"tag":1026,"props":1684,"children":1685},{"style":1049},[1686],{"type":998,"value":1199},{"type":993,"tag":1026,"props":1688,"children":1689},{"style":1067},[1690],{"type":998,"value":1324},{"type":993,"tag":1026,"props":1692,"children":1693},{"class":1028,"line":329},[1694,1698,1702,1707,1711,1715],{"type":993,"tag":1026,"props":1695,"children":1696},{"style":1049},[1697],{"type":998,"value":1332},{"type":993,"tag":1026,"props":1699,"children":1700},{"style":1067},[1701],{"type":998,"value":1103},{"type":993,"tag":1026,"props":1703,"children":1704},{"style":1073},[1705],{"type":998,"value":1706},"\"Additional content",{"type":993,"tag":1026,"props":1708,"children":1709},{"style":1061},[1710],{"type":998,"value":1365},{"type":993,"tag":1026,"props":1712,"children":1713},{"style":1073},[1714],{"type":998,"value":1245},{"type":993,"tag":1026,"props":1716,"children":1717},{"style":1067},[1718],{"type":998,"value":1091},{"type":993,"tag":1026,"props":1720,"children":1721},{"class":1028,"line":338},[1722],{"type":993,"tag":1026,"props":1723,"children":1724},{"emptyLinePlaceholder":13},[1725],{"type":998,"value":1137},{"type":993,"tag":1026,"props":1727,"children":1728},{"class":1028,"line":347},[1729],{"type":993,"tag":1026,"props":1730,"children":1731},{"style":1032},[1732],{"type":998,"value":1733},"# Read mode - reads file content\n",{"type":993,"tag":1026,"props":1735,"children":1736},{"class":1028,"line":356},[1737,1741,1745,1749,1753,1757,1761,1765],{"type":993,"tag":1026,"props":1738,"children":1739},{"style":1055},[1740],{"type":998,"value":1284},{"type":993,"tag":1026,"props":1742,"children":1743},{"style":1061},[1744],{"type":998,"value":1064},{"type":993,"tag":1026,"props":1746,"children":1747},{"style":1067},[1748],{"type":998,"value":1591},{"type":993,"tag":1026,"props":1750,"children":1751},{"style":1073},[1752],{"type":998,"value":1177},{"type":993,"tag":1026,"props":1754,"children":1755},{"style":1067},[1756],{"type":998,"value":1310},{"type":993,"tag":1026,"props":1758,"children":1759},{"style":1055},[1760],{"type":998,"value":1315},{"type":993,"tag":1026,"props":1762,"children":1763},{"style":1049},[1764],{"type":998,"value":1199},{"type":993,"tag":1026,"props":1766,"children":1767},{"style":1067},[1768],{"type":998,"value":1324},{"type":993,"tag":1026,"props":1770,"children":1771},{"class":1028,"line":365},[1772,1776,1780,1784],{"type":993,"tag":1026,"props":1773,"children":1774},{"style":1067},[1775],{"type":998,"value":1475},{"type":993,"tag":1026,"props":1777,"children":1778},{"style":1055},[1779],{"type":998,"value":1194},{"type":993,"tag":1026,"props":1781,"children":1782},{"style":1049},[1783],{"type":998,"value":1199},{"type":993,"tag":1026,"props":1785,"children":1786},{"style":1067},[1787],{"type":998,"value":1204},{"type":993,"tag":1026,"props":1789,"children":1790},{"class":1028,"line":374},[1791,1795,1799,1803,1808,1813,1817,1821,1825],{"type":993,"tag":1026,"props":1792,"children":1793},{"style":1061},[1794],{"type":998,"value":1495},{"type":993,"tag":1026,"props":1796,"children":1797},{"style":1067},[1798],{"type":998,"value":1070},{"type":993,"tag":1026,"props":1800,"children":1801},{"style":1055},[1802],{"type":998,"value":1221},{"type":993,"tag":1026,"props":1804,"children":1805},{"style":1073},[1806],{"type":998,"value":1807},"\"Final content:",{"type":993,"tag":1026,"props":1809,"children":1810},{"style":1061},[1811],{"type":998,"value":1812},"\\n{",{"type":993,"tag":1026,"props":1814,"children":1815},{"style":1067},[1816],{"type":998,"value":17},{"type":993,"tag":1026,"props":1818,"children":1819},{"style":1061},[1820],{"type":998,"value":1240},{"type":993,"tag":1026,"props":1822,"children":1823},{"style":1073},[1824],{"type":998,"value":1245},{"type":993,"tag":1026,"props":1826,"children":1827},{"style":1067},[1828],{"type":998,"value":1091},{"type":993,"tag":1830,"props":1831,"children":1833},"h2",{"id":1832},"understanding-file-operations",[1834],{"type":998,"value":1835},"🎯 Understanding File Operations",{"type":993,"tag":1001,"props":1837,"children":1838},{},[1839],{"type":998,"value":1840},"File handling requires understanding file modes, proper resource management, and error handling for reliable applications.",{"type":993,"tag":1842,"props":1843,"children":1847},"info-box",{"emoji":1844,"title":1845,"type":1846},"🔧","File Basics Fundamentals","info",[1848,1857,1865,1900,1908,1941,1949,1982,1990,2023,2031,2091,2099],{"type":993,"tag":1001,"props":1849,"children":1850},{},[1851],{"type":993,"tag":1852,"props":1853,"children":1854},"strong",{},[1855],{"type":998,"value":1856},"File Modes:",{"type":993,"tag":1001,"props":1858,"children":1859},{},[1860],{"type":993,"tag":1852,"props":1861,"children":1862},{},[1863],{"type":998,"value":1864},"Reading Modes:",{"type":993,"tag":1866,"props":1867,"children":1868},"ul",{},[1869,1880,1890],{"type":993,"tag":1870,"props":1871,"children":1872},"li",{},[1873,1878],{"type":993,"tag":1852,"props":1874,"children":1875},{},[1876],{"type":998,"value":1877},"'r'",{"type":998,"value":1879},": Read text (default mode)",{"type":993,"tag":1870,"props":1881,"children":1882},{},[1883,1888],{"type":993,"tag":1852,"props":1884,"children":1885},{},[1886],{"type":998,"value":1887},"'rb'",{"type":998,"value":1889},": Read binary data",{"type":993,"tag":1870,"props":1891,"children":1892},{},[1893,1898],{"type":993,"tag":1852,"props":1894,"children":1895},{},[1896],{"type":998,"value":1897},"'rt'",{"type":998,"value":1899},": Read text explicitly",{"type":993,"tag":1001,"props":1901,"children":1902},{},[1903],{"type":993,"tag":1852,"props":1904,"children":1905},{},[1906],{"type":998,"value":1907},"Writing Modes:",{"type":993,"tag":1866,"props":1909,"children":1910},{},[1911,1921,1931],{"type":993,"tag":1870,"props":1912,"children":1913},{},[1914,1919],{"type":993,"tag":1852,"props":1915,"children":1916},{},[1917],{"type":998,"value":1918},"'w'",{"type":998,"value":1920},": Write text (overwrites existing file)",{"type":993,"tag":1870,"props":1922,"children":1923},{},[1924,1929],{"type":993,"tag":1852,"props":1925,"children":1926},{},[1927],{"type":998,"value":1928},"'wb'",{"type":998,"value":1930},": Write binary data",{"type":993,"tag":1870,"props":1932,"children":1933},{},[1934,1939],{"type":993,"tag":1852,"props":1935,"children":1936},{},[1937],{"type":998,"value":1938},"'wt'",{"type":998,"value":1940},": Write text explicitly",{"type":993,"tag":1001,"props":1942,"children":1943},{},[1944],{"type":993,"tag":1852,"props":1945,"children":1946},{},[1947],{"type":998,"value":1948},"Append Modes:",{"type":993,"tag":1866,"props":1950,"children":1951},{},[1952,1962,1972],{"type":993,"tag":1870,"props":1953,"children":1954},{},[1955,1960],{"type":993,"tag":1852,"props":1956,"children":1957},{},[1958],{"type":998,"value":1959},"'a'",{"type":998,"value":1961},": Append to end of file",{"type":993,"tag":1870,"props":1963,"children":1964},{},[1965,1970],{"type":993,"tag":1852,"props":1966,"children":1967},{},[1968],{"type":998,"value":1969},"'ab'",{"type":998,"value":1971},": Append binary data",{"type":993,"tag":1870,"props":1973,"children":1974},{},[1975,1980],{"type":993,"tag":1852,"props":1976,"children":1977},{},[1978],{"type":998,"value":1979},"'at'",{"type":998,"value":1981},": Append text explicitly",{"type":993,"tag":1001,"props":1983,"children":1984},{},[1985],{"type":993,"tag":1852,"props":1986,"children":1987},{},[1988],{"type":998,"value":1989},"Read/Write Modes:",{"type":993,"tag":1866,"props":1991,"children":1992},{},[1993,2003,2013],{"type":993,"tag":1870,"props":1994,"children":1995},{},[1996,2001],{"type":993,"tag":1852,"props":1997,"children":1998},{},[1999],{"type":998,"value":2000},"'r+'",{"type":998,"value":2002},": Read and write (file must exist)",{"type":993,"tag":1870,"props":2004,"children":2005},{},[2006,2011],{"type":993,"tag":1852,"props":2007,"children":2008},{},[2009],{"type":998,"value":2010},"'w+'",{"type":998,"value":2012},": Read and write (overwrites existing)",{"type":993,"tag":1870,"props":2014,"children":2015},{},[2016,2021],{"type":993,"tag":1852,"props":2017,"children":2018},{},[2019],{"type":998,"value":2020},"'a+'",{"type":998,"value":2022},": Read and append",{"type":993,"tag":1001,"props":2024,"children":2025},{},[2026],{"type":993,"tag":1852,"props":2027,"children":2028},{},[2029],{"type":998,"value":2030},"Best Practices:",{"type":993,"tag":1866,"props":2032,"children":2033},{},[2034,2051,2061,2071,2081],{"type":993,"tag":1870,"props":2035,"children":2036},{},[2037,2042,2044,2049],{"type":993,"tag":1852,"props":2038,"children":2039},{},[2040],{"type":998,"value":2041},"Use Context Managers",{"type":998,"value":2043},": Always use ",{"type":993,"tag":1022,"props":2045,"children":2047},{"className":2046},[],[2048],{"type":998,"value":1284},{"type":998,"value":2050}," statements",{"type":993,"tag":1870,"props":2052,"children":2053},{},[2054,2059],{"type":993,"tag":1852,"props":2055,"children":2056},{},[2057],{"type":998,"value":2058},"Specify Encoding",{"type":998,"value":2060},": Include encoding for text files",{"type":993,"tag":1870,"props":2062,"children":2063},{},[2064,2069],{"type":993,"tag":1852,"props":2065,"children":2066},{},[2067],{"type":998,"value":2068},"Handle Errors",{"type":998,"value":2070},": Use try/except for file operations",{"type":993,"tag":1870,"props":2072,"children":2073},{},[2074,2079],{"type":993,"tag":1852,"props":2075,"children":2076},{},[2077],{"type":998,"value":2078},"Check File Existence",{"type":998,"value":2080},": Verify files exist before opening",{"type":993,"tag":1870,"props":2082,"children":2083},{},[2084,2089],{"type":993,"tag":1852,"props":2085,"children":2086},{},[2087],{"type":998,"value":2088},"Choose Correct Mode",{"type":998,"value":2090},": Select appropriate mode for your needs",{"type":993,"tag":1001,"props":2092,"children":2093},{},[2094],{"type":993,"tag":1852,"props":2095,"children":2096},{},[2097],{"type":998,"value":2098},"Common File Extensions:",{"type":993,"tag":1866,"props":2100,"children":2101},{},[2102,2112,2122],{"type":993,"tag":1870,"props":2103,"children":2104},{},[2105,2110],{"type":993,"tag":1852,"props":2106,"children":2107},{},[2108],{"type":998,"value":2109},"Text Files",{"type":998,"value":2111},": .txt, .csv, .log, .md, .py",{"type":993,"tag":1870,"props":2113,"children":2114},{},[2115,2120],{"type":993,"tag":1852,"props":2116,"children":2117},{},[2118],{"type":998,"value":2119},"Data Files",{"type":998,"value":2121},": .json, .xml, .yaml, .ini",{"type":993,"tag":1870,"props":2123,"children":2124},{},[2125,2130],{"type":993,"tag":1852,"props":2126,"children":2127},{},[2128],{"type":998,"value":2129},"Binary Files",{"type":998,"value":2131},": .jpg, .png, .pdf, .zip",{"type":993,"tag":2133,"props":2134,"children":2136},"h3",{"id":2135},"file-opening-fundamentals",[2137],{"type":998,"value":2138},"File Opening Fundamentals",{"type":993,"tag":1001,"props":2140,"children":2141},{},[2142],{"type":998,"value":2143},"Understanding how Python opens files and manages file objects is essential for effective file handling.",{"type":993,"tag":1012,"props":2145,"children":2146},{},[2147],{"type":993,"tag":1016,"props":2148,"children":2150},{"className":1018,"code":2149,"language":6,"meta":8,"style":8},"def demonstrate_file_opening():\n    \"\"\"Show basic file opening concepts\"\"\"\n    \n    # Create a sample file first\n    filename = \"sample.txt\"\n    \n    # Method 1: Basic open (requires manual closing)\n    print(\"Method 1: Basic file opening\")\n    file = open(filename, \"w\")\n    file.write(\"This is a test file.\\n\")\n    file.write(\"It contains sample data.\\n\")\n    file.close()  # Must remember to close\n    print(\"File created and closed manually\")\n    \n    # Method 2: Context manager (recommended)\n    print(\"\\nMethod 2: Context manager (recommended)\")\n    with open(filename, \"r\") as file:\n        content = file.read()\n        print(f\"File content:\\n{content}\")\n    # File automatically closed here\n    print(\"File automatically closed by context manager\")\n    \n    # Method 3: Error handling with context manager\n    print(\"\\nMethod 3: Safe file opening with error handling\")\n    try:\n        with open(\"nonexistent.txt\", \"r\") as file:\n            content = file.read()\n    except FileNotFoundError:\n        print(\"File not found - handled gracefully\")\n    except PermissionError:\n        print(\"Permission denied - handled gracefully\")\n\ndemonstrate_file_opening()\n",[2151],{"type":993,"tag":1022,"props":2152,"children":2153},{"__ignoreMap":8},[2154,2173,2181,2189,2197,2214,2221,2229,2249,2276,2304,2332,2348,2368,2375,2383,2411,2447,2467,2508,2516,2536,2543,2551,2579,2591,2636,2656,2673,2693,2709,2729,2736],{"type":993,"tag":1026,"props":2155,"children":2156},{"class":1028,"line":12},[2157,2162,2168],{"type":993,"tag":1026,"props":2158,"children":2159},{"style":1055},[2160],{"type":998,"value":2161},"def",{"type":993,"tag":1026,"props":2163,"children":2165},{"style":2164},"--shiki-default:#6F42C1;--shiki-app-dark-mode:#B392F0",[2166],{"type":998,"value":2167}," demonstrate_file_opening",{"type":993,"tag":1026,"props":2169,"children":2170},{"style":1067},[2171],{"type":998,"value":2172},"():\n",{"type":993,"tag":1026,"props":2174,"children":2175},{"class":1028,"line":27},[2176],{"type":993,"tag":1026,"props":2177,"children":2178},{"style":1073},[2179],{"type":998,"value":2180},"    \"\"\"Show basic file opening concepts\"\"\"\n",{"type":993,"tag":1026,"props":2182,"children":2183},{"class":1028,"line":36},[2184],{"type":993,"tag":1026,"props":2185,"children":2186},{"style":1067},[2187],{"type":998,"value":2188},"    \n",{"type":993,"tag":1026,"props":2190,"children":2191},{"class":1028,"line":45},[2192],{"type":993,"tag":1026,"props":2193,"children":2194},{"style":1032},[2195],{"type":998,"value":2196},"    # Create a sample file first\n",{"type":993,"tag":1026,"props":2198,"children":2199},{"class":1028,"line":54},[2200,2205,2209],{"type":993,"tag":1026,"props":2201,"children":2202},{"style":1067},[2203],{"type":998,"value":2204},"    filename ",{"type":993,"tag":1026,"props":2206,"children":2207},{"style":1055},[2208],{"type":998,"value":1194},{"type":993,"tag":1026,"props":2210,"children":2211},{"style":1073},[2212],{"type":998,"value":2213}," \"sample.txt\"\n",{"type":993,"tag":1026,"props":2215,"children":2216},{"class":1028,"line":63},[2217],{"type":993,"tag":1026,"props":2218,"children":2219},{"style":1067},[2220],{"type":998,"value":2188},{"type":993,"tag":1026,"props":2222,"children":2223},{"class":1028,"line":72},[2224],{"type":993,"tag":1026,"props":2225,"children":2226},{"style":1032},[2227],{"type":998,"value":2228},"    # Method 1: Basic open (requires manual closing)\n",{"type":993,"tag":1026,"props":2230,"children":2231},{"class":1028,"line":81},[2232,2236,2240,2245],{"type":993,"tag":1026,"props":2233,"children":2234},{"style":1061},[2235],{"type":998,"value":1495},{"type":993,"tag":1026,"props":2237,"children":2238},{"style":1067},[2239],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2241,"children":2242},{"style":1073},[2243],{"type":998,"value":2244},"\"Method 1: Basic file opening\"",{"type":993,"tag":1026,"props":2246,"children":2247},{"style":1067},[2248],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2250,"children":2251},{"class":1028,"line":91},[2252,2256,2260,2264,2268,2272],{"type":993,"tag":1026,"props":2253,"children":2254},{"style":1049},[2255],{"type":998,"value":1332},{"type":993,"tag":1026,"props":2257,"children":2258},{"style":1055},[2259],{"type":998,"value":1058},{"type":993,"tag":1026,"props":2261,"children":2262},{"style":1061},[2263],{"type":998,"value":1064},{"type":993,"tag":1026,"props":2265,"children":2266},{"style":1067},[2267],{"type":998,"value":1591},{"type":993,"tag":1026,"props":2269,"children":2270},{"style":1073},[2271],{"type":998,"value":1086},{"type":993,"tag":1026,"props":2273,"children":2274},{"style":1067},[2275],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2277,"children":2278},{"class":1028,"line":100},[2279,2283,2287,2292,2296,2300],{"type":993,"tag":1026,"props":2280,"children":2281},{"style":1049},[2282],{"type":998,"value":1332},{"type":993,"tag":1026,"props":2284,"children":2285},{"style":1067},[2286],{"type":998,"value":1103},{"type":993,"tag":1026,"props":2288,"children":2289},{"style":1073},[2290],{"type":998,"value":2291},"\"This is a test file.",{"type":993,"tag":1026,"props":2293,"children":2294},{"style":1061},[2295],{"type":998,"value":1365},{"type":993,"tag":1026,"props":2297,"children":2298},{"style":1073},[2299],{"type":998,"value":1245},{"type":993,"tag":1026,"props":2301,"children":2302},{"style":1067},[2303],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2305,"children":2306},{"class":1028,"line":109},[2307,2311,2315,2320,2324,2328],{"type":993,"tag":1026,"props":2308,"children":2309},{"style":1049},[2310],{"type":998,"value":1332},{"type":993,"tag":1026,"props":2312,"children":2313},{"style":1067},[2314],{"type":998,"value":1103},{"type":993,"tag":1026,"props":2316,"children":2317},{"style":1073},[2318],{"type":998,"value":2319},"\"It contains sample data.",{"type":993,"tag":1026,"props":2321,"children":2322},{"style":1061},[2323],{"type":998,"value":1365},{"type":993,"tag":1026,"props":2325,"children":2326},{"style":1073},[2327],{"type":998,"value":1245},{"type":993,"tag":1026,"props":2329,"children":2330},{"style":1067},[2331],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2333,"children":2334},{"class":1028,"line":118},[2335,2339,2343],{"type":993,"tag":1026,"props":2336,"children":2337},{"style":1049},[2338],{"type":998,"value":1332},{"type":993,"tag":1026,"props":2340,"children":2341},{"style":1067},[2342],{"type":998,"value":1124},{"type":993,"tag":1026,"props":2344,"children":2345},{"style":1032},[2346],{"type":998,"value":2347},"# Must remember to close\n",{"type":993,"tag":1026,"props":2349,"children":2350},{"class":1028,"line":127},[2351,2355,2359,2364],{"type":993,"tag":1026,"props":2352,"children":2353},{"style":1061},[2354],{"type":998,"value":1495},{"type":993,"tag":1026,"props":2356,"children":2357},{"style":1067},[2358],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2360,"children":2361},{"style":1073},[2362],{"type":998,"value":2363},"\"File created and closed manually\"",{"type":993,"tag":1026,"props":2365,"children":2366},{"style":1067},[2367],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2369,"children":2370},{"class":1028,"line":136},[2371],{"type":993,"tag":1026,"props":2372,"children":2373},{"style":1067},[2374],{"type":998,"value":2188},{"type":993,"tag":1026,"props":2376,"children":2377},{"class":1028,"line":146},[2378],{"type":993,"tag":1026,"props":2379,"children":2380},{"style":1032},[2381],{"type":998,"value":2382},"    # Method 2: Context manager (recommended)\n",{"type":993,"tag":1026,"props":2384,"children":2385},{"class":1028,"line":155},[2386,2390,2394,2398,2402,2407],{"type":993,"tag":1026,"props":2387,"children":2388},{"style":1061},[2389],{"type":998,"value":1495},{"type":993,"tag":1026,"props":2391,"children":2392},{"style":1067},[2393],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2395,"children":2396},{"style":1073},[2397],{"type":998,"value":1245},{"type":993,"tag":1026,"props":2399,"children":2400},{"style":1061},[2401],{"type":998,"value":1365},{"type":993,"tag":1026,"props":2403,"children":2404},{"style":1073},[2405],{"type":998,"value":2406},"Method 2: Context manager (recommended)\"",{"type":993,"tag":1026,"props":2408,"children":2409},{"style":1067},[2410],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2412,"children":2413},{"class":1028,"line":164},[2414,2419,2423,2427,2431,2435,2439,2443],{"type":993,"tag":1026,"props":2415,"children":2416},{"style":1055},[2417],{"type":998,"value":2418},"    with",{"type":993,"tag":1026,"props":2420,"children":2421},{"style":1061},[2422],{"type":998,"value":1064},{"type":993,"tag":1026,"props":2424,"children":2425},{"style":1067},[2426],{"type":998,"value":1591},{"type":993,"tag":1026,"props":2428,"children":2429},{"style":1073},[2430],{"type":998,"value":1177},{"type":993,"tag":1026,"props":2432,"children":2433},{"style":1067},[2434],{"type":998,"value":1310},{"type":993,"tag":1026,"props":2436,"children":2437},{"style":1055},[2438],{"type":998,"value":1315},{"type":993,"tag":1026,"props":2440,"children":2441},{"style":1049},[2442],{"type":998,"value":1199},{"type":993,"tag":1026,"props":2444,"children":2445},{"style":1067},[2446],{"type":998,"value":1324},{"type":993,"tag":1026,"props":2448,"children":2449},{"class":1028,"line":173},[2450,2455,2459,2463],{"type":993,"tag":1026,"props":2451,"children":2452},{"style":1067},[2453],{"type":998,"value":2454},"        content ",{"type":993,"tag":1026,"props":2456,"children":2457},{"style":1055},[2458],{"type":998,"value":1194},{"type":993,"tag":1026,"props":2460,"children":2461},{"style":1049},[2462],{"type":998,"value":1199},{"type":993,"tag":1026,"props":2464,"children":2465},{"style":1067},[2466],{"type":998,"value":1204},{"type":993,"tag":1026,"props":2468,"children":2469},{"class":1028,"line":182},[2470,2475,2479,2483,2488,2492,2496,2500,2504],{"type":993,"tag":1026,"props":2471,"children":2472},{"style":1061},[2473],{"type":998,"value":2474},"        print",{"type":993,"tag":1026,"props":2476,"children":2477},{"style":1067},[2478],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2480,"children":2481},{"style":1055},[2482],{"type":998,"value":1221},{"type":993,"tag":1026,"props":2484,"children":2485},{"style":1073},[2486],{"type":998,"value":2487},"\"File content:",{"type":993,"tag":1026,"props":2489,"children":2490},{"style":1061},[2491],{"type":998,"value":1812},{"type":993,"tag":1026,"props":2493,"children":2494},{"style":1067},[2495],{"type":998,"value":17},{"type":993,"tag":1026,"props":2497,"children":2498},{"style":1061},[2499],{"type":998,"value":1240},{"type":993,"tag":1026,"props":2501,"children":2502},{"style":1073},[2503],{"type":998,"value":1245},{"type":993,"tag":1026,"props":2505,"children":2506},{"style":1067},[2507],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2509,"children":2510},{"class":1028,"line":191},[2511],{"type":993,"tag":1026,"props":2512,"children":2513},{"style":1032},[2514],{"type":998,"value":2515},"    # File automatically closed here\n",{"type":993,"tag":1026,"props":2517,"children":2518},{"class":1028,"line":201},[2519,2523,2527,2532],{"type":993,"tag":1026,"props":2520,"children":2521},{"style":1061},[2522],{"type":998,"value":1495},{"type":993,"tag":1026,"props":2524,"children":2525},{"style":1067},[2526],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2528,"children":2529},{"style":1073},[2530],{"type":998,"value":2531},"\"File automatically closed by context manager\"",{"type":993,"tag":1026,"props":2533,"children":2534},{"style":1067},[2535],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2537,"children":2538},{"class":1028,"line":210},[2539],{"type":993,"tag":1026,"props":2540,"children":2541},{"style":1067},[2542],{"type":998,"value":2188},{"type":993,"tag":1026,"props":2544,"children":2545},{"class":1028,"line":219},[2546],{"type":993,"tag":1026,"props":2547,"children":2548},{"style":1032},[2549],{"type":998,"value":2550},"    # Method 3: Error handling with context manager\n",{"type":993,"tag":1026,"props":2552,"children":2553},{"class":1028,"line":228},[2554,2558,2562,2566,2570,2575],{"type":993,"tag":1026,"props":2555,"children":2556},{"style":1061},[2557],{"type":998,"value":1495},{"type":993,"tag":1026,"props":2559,"children":2560},{"style":1067},[2561],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2563,"children":2564},{"style":1073},[2565],{"type":998,"value":1245},{"type":993,"tag":1026,"props":2567,"children":2568},{"style":1061},[2569],{"type":998,"value":1365},{"type":993,"tag":1026,"props":2571,"children":2572},{"style":1073},[2573],{"type":998,"value":2574},"Method 3: Safe file opening with error handling\"",{"type":993,"tag":1026,"props":2576,"children":2577},{"style":1067},[2578],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2580,"children":2581},{"class":1028,"line":238},[2582,2587],{"type":993,"tag":1026,"props":2583,"children":2584},{"style":1055},[2585],{"type":998,"value":2586},"    try",{"type":993,"tag":1026,"props":2588,"children":2589},{"style":1067},[2590],{"type":998,"value":1324},{"type":993,"tag":1026,"props":2592,"children":2593},{"class":1028,"line":247},[2594,2599,2603,2607,2612,2616,2620,2624,2628,2632],{"type":993,"tag":1026,"props":2595,"children":2596},{"style":1055},[2597],{"type":998,"value":2598},"        with",{"type":993,"tag":1026,"props":2600,"children":2601},{"style":1061},[2602],{"type":998,"value":1064},{"type":993,"tag":1026,"props":2604,"children":2605},{"style":1067},[2606],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2608,"children":2609},{"style":1073},[2610],{"type":998,"value":2611},"\"nonexistent.txt\"",{"type":993,"tag":1026,"props":2613,"children":2614},{"style":1067},[2615],{"type":998,"value":1081},{"type":993,"tag":1026,"props":2617,"children":2618},{"style":1073},[2619],{"type":998,"value":1177},{"type":993,"tag":1026,"props":2621,"children":2622},{"style":1067},[2623],{"type":998,"value":1310},{"type":993,"tag":1026,"props":2625,"children":2626},{"style":1055},[2627],{"type":998,"value":1315},{"type":993,"tag":1026,"props":2629,"children":2630},{"style":1049},[2631],{"type":998,"value":1199},{"type":993,"tag":1026,"props":2633,"children":2634},{"style":1067},[2635],{"type":998,"value":1324},{"type":993,"tag":1026,"props":2637,"children":2638},{"class":1028,"line":256},[2639,2644,2648,2652],{"type":993,"tag":1026,"props":2640,"children":2641},{"style":1067},[2642],{"type":998,"value":2643},"            content ",{"type":993,"tag":1026,"props":2645,"children":2646},{"style":1055},[2647],{"type":998,"value":1194},{"type":993,"tag":1026,"props":2649,"children":2650},{"style":1049},[2651],{"type":998,"value":1199},{"type":993,"tag":1026,"props":2653,"children":2654},{"style":1067},[2655],{"type":998,"value":1204},{"type":993,"tag":1026,"props":2657,"children":2658},{"class":1028,"line":265},[2659,2664,2669],{"type":993,"tag":1026,"props":2660,"children":2661},{"style":1055},[2662],{"type":998,"value":2663},"    except",{"type":993,"tag":1026,"props":2665,"children":2666},{"style":1061},[2667],{"type":998,"value":2668}," FileNotFoundError",{"type":993,"tag":1026,"props":2670,"children":2671},{"style":1067},[2672],{"type":998,"value":1324},{"type":993,"tag":1026,"props":2674,"children":2675},{"class":1028,"line":274},[2676,2680,2684,2689],{"type":993,"tag":1026,"props":2677,"children":2678},{"style":1061},[2679],{"type":998,"value":2474},{"type":993,"tag":1026,"props":2681,"children":2682},{"style":1067},[2683],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2685,"children":2686},{"style":1073},[2687],{"type":998,"value":2688},"\"File not found - handled gracefully\"",{"type":993,"tag":1026,"props":2690,"children":2691},{"style":1067},[2692],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2694,"children":2695},{"class":1028,"line":284},[2696,2700,2705],{"type":993,"tag":1026,"props":2697,"children":2698},{"style":1055},[2699],{"type":998,"value":2663},{"type":993,"tag":1026,"props":2701,"children":2702},{"style":1061},[2703],{"type":998,"value":2704}," PermissionError",{"type":993,"tag":1026,"props":2706,"children":2707},{"style":1067},[2708],{"type":998,"value":1324},{"type":993,"tag":1026,"props":2710,"children":2711},{"class":1028,"line":293},[2712,2716,2720,2725],{"type":993,"tag":1026,"props":2713,"children":2714},{"style":1061},[2715],{"type":998,"value":2474},{"type":993,"tag":1026,"props":2717,"children":2718},{"style":1067},[2719],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2721,"children":2722},{"style":1073},[2723],{"type":998,"value":2724},"\"Permission denied - handled gracefully\"",{"type":993,"tag":1026,"props":2726,"children":2727},{"style":1067},[2728],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2730,"children":2731},{"class":1028,"line":302},[2732],{"type":993,"tag":1026,"props":2733,"children":2734},{"emptyLinePlaceholder":13},[2735],{"type":998,"value":1137},{"type":993,"tag":1026,"props":2737,"children":2738},{"class":1028,"line":311},[2739],{"type":993,"tag":1026,"props":2740,"children":2741},{"style":1067},[2742],{"type":998,"value":2743},"demonstrate_file_opening()\n",{"type":993,"tag":2133,"props":2745,"children":2747},{"id":2746},"file-mode-selection",[2748],{"type":998,"value":2749},"File Mode Selection",{"type":993,"tag":1001,"props":2751,"children":2752},{},[2753],{"type":998,"value":2754},"Choosing the correct file mode ensures your program can perform the intended operations safely.",{"type":993,"tag":1012,"props":2756,"children":2757},{},[2758],{"type":993,"tag":1016,"props":2759,"children":2761},{"className":1018,"code":2760,"language":6,"meta":8,"style":8},"def file_mode_examples():\n    \"\"\"Demonstrate different file modes and their uses\"\"\"\n    \n    filename = \"mode_test.txt\"\n    \n    # Write mode - creates new file or overwrites\n    print(\"1. Write mode ('w') - creates or overwrites\")\n    with open(filename, \"w\") as file:\n        file.write(\"Line 1: Original content\\n\")\n        file.write(\"Line 2: More content\\n\")\n    \n    # Read mode - reads existing file\n    print(\"2. Read mode ('r') - reads file content\")\n    with open(filename, \"r\") as file:\n        content = file.read()\n        print(f\"Content:\\n{content}\")\n    \n    # Append mode - adds to end of file\n    print(\"3. Append mode ('a') - adds to end\")\n    with open(filename, \"a\") as file:\n        file.write(\"Line 3: Appended content\\n\")\n    \n    # Read updated file\n    with open(filename, \"r\") as file:\n        updated_content = file.read()\n        print(f\"Updated content:\\n{updated_content}\")\n    \n    # Read and write mode\n    print(\"4. Read/write mode ('r+') - read and modify\")\n    with open(filename, \"r+\") as file:\n        # Read current content\n        content = file.read()\n        # Go back to beginning\n        file.seek(0)\n        # Write new content\n        file.write(\"Modified: \" + content)\n        file.truncate()  # Remove any remaining old content\n    \n    # Show final result\n    with open(filename, \"r\") as file:\n        final_content = file.read()\n        print(f\"Final content:\\n{final_content}\")\n\nfile_mode_examples()\n",[2762],{"type":993,"tag":1022,"props":2763,"children":2764},{"__ignoreMap":8},[2765,2781,2789,2796,2812,2819,2827,2847,2882,2911,2939,2946,2954,2974,3009,3028,3068,3075,3083,3103,3138,3166,3173,3181,3216,3236,3277,3284,3292,3312,3348,3356,3375,3383,3404,3412,3438,3455,3462,3470,3505,3525,3565,3572],{"type":993,"tag":1026,"props":2766,"children":2767},{"class":1028,"line":12},[2768,2772,2777],{"type":993,"tag":1026,"props":2769,"children":2770},{"style":1055},[2771],{"type":998,"value":2161},{"type":993,"tag":1026,"props":2773,"children":2774},{"style":2164},[2775],{"type":998,"value":2776}," file_mode_examples",{"type":993,"tag":1026,"props":2778,"children":2779},{"style":1067},[2780],{"type":998,"value":2172},{"type":993,"tag":1026,"props":2782,"children":2783},{"class":1028,"line":27},[2784],{"type":993,"tag":1026,"props":2785,"children":2786},{"style":1073},[2787],{"type":998,"value":2788},"    \"\"\"Demonstrate different file modes and their uses\"\"\"\n",{"type":993,"tag":1026,"props":2790,"children":2791},{"class":1028,"line":36},[2792],{"type":993,"tag":1026,"props":2793,"children":2794},{"style":1067},[2795],{"type":998,"value":2188},{"type":993,"tag":1026,"props":2797,"children":2798},{"class":1028,"line":45},[2799,2803,2807],{"type":993,"tag":1026,"props":2800,"children":2801},{"style":1067},[2802],{"type":998,"value":2204},{"type":993,"tag":1026,"props":2804,"children":2805},{"style":1055},[2806],{"type":998,"value":1194},{"type":993,"tag":1026,"props":2808,"children":2809},{"style":1073},[2810],{"type":998,"value":2811}," \"mode_test.txt\"\n",{"type":993,"tag":1026,"props":2813,"children":2814},{"class":1028,"line":54},[2815],{"type":993,"tag":1026,"props":2816,"children":2817},{"style":1067},[2818],{"type":998,"value":2188},{"type":993,"tag":1026,"props":2820,"children":2821},{"class":1028,"line":63},[2822],{"type":993,"tag":1026,"props":2823,"children":2824},{"style":1032},[2825],{"type":998,"value":2826},"    # Write mode - creates new file or overwrites\n",{"type":993,"tag":1026,"props":2828,"children":2829},{"class":1028,"line":72},[2830,2834,2838,2843],{"type":993,"tag":1026,"props":2831,"children":2832},{"style":1061},[2833],{"type":998,"value":1495},{"type":993,"tag":1026,"props":2835,"children":2836},{"style":1067},[2837],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2839,"children":2840},{"style":1073},[2841],{"type":998,"value":2842},"\"1. Write mode ('w') - creates or overwrites\"",{"type":993,"tag":1026,"props":2844,"children":2845},{"style":1067},[2846],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2848,"children":2849},{"class":1028,"line":81},[2850,2854,2858,2862,2866,2870,2874,2878],{"type":993,"tag":1026,"props":2851,"children":2852},{"style":1055},[2853],{"type":998,"value":2418},{"type":993,"tag":1026,"props":2855,"children":2856},{"style":1061},[2857],{"type":998,"value":1064},{"type":993,"tag":1026,"props":2859,"children":2860},{"style":1067},[2861],{"type":998,"value":1591},{"type":993,"tag":1026,"props":2863,"children":2864},{"style":1073},[2865],{"type":998,"value":1086},{"type":993,"tag":1026,"props":2867,"children":2868},{"style":1067},[2869],{"type":998,"value":1310},{"type":993,"tag":1026,"props":2871,"children":2872},{"style":1055},[2873],{"type":998,"value":1315},{"type":993,"tag":1026,"props":2875,"children":2876},{"style":1049},[2877],{"type":998,"value":1199},{"type":993,"tag":1026,"props":2879,"children":2880},{"style":1067},[2881],{"type":998,"value":1324},{"type":993,"tag":1026,"props":2883,"children":2884},{"class":1028,"line":91},[2885,2890,2894,2899,2903,2907],{"type":993,"tag":1026,"props":2886,"children":2887},{"style":1049},[2888],{"type":998,"value":2889},"        file",{"type":993,"tag":1026,"props":2891,"children":2892},{"style":1067},[2893],{"type":998,"value":1103},{"type":993,"tag":1026,"props":2895,"children":2896},{"style":1073},[2897],{"type":998,"value":2898},"\"Line 1: Original content",{"type":993,"tag":1026,"props":2900,"children":2901},{"style":1061},[2902],{"type":998,"value":1365},{"type":993,"tag":1026,"props":2904,"children":2905},{"style":1073},[2906],{"type":998,"value":1245},{"type":993,"tag":1026,"props":2908,"children":2909},{"style":1067},[2910],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2912,"children":2913},{"class":1028,"line":100},[2914,2918,2922,2927,2931,2935],{"type":993,"tag":1026,"props":2915,"children":2916},{"style":1049},[2917],{"type":998,"value":2889},{"type":993,"tag":1026,"props":2919,"children":2920},{"style":1067},[2921],{"type":998,"value":1103},{"type":993,"tag":1026,"props":2923,"children":2924},{"style":1073},[2925],{"type":998,"value":2926},"\"Line 2: More content",{"type":993,"tag":1026,"props":2928,"children":2929},{"style":1061},[2930],{"type":998,"value":1365},{"type":993,"tag":1026,"props":2932,"children":2933},{"style":1073},[2934],{"type":998,"value":1245},{"type":993,"tag":1026,"props":2936,"children":2937},{"style":1067},[2938],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2940,"children":2941},{"class":1028,"line":109},[2942],{"type":993,"tag":1026,"props":2943,"children":2944},{"style":1067},[2945],{"type":998,"value":2188},{"type":993,"tag":1026,"props":2947,"children":2948},{"class":1028,"line":118},[2949],{"type":993,"tag":1026,"props":2950,"children":2951},{"style":1032},[2952],{"type":998,"value":2953},"    # Read mode - reads existing file\n",{"type":993,"tag":1026,"props":2955,"children":2956},{"class":1028,"line":127},[2957,2961,2965,2970],{"type":993,"tag":1026,"props":2958,"children":2959},{"style":1061},[2960],{"type":998,"value":1495},{"type":993,"tag":1026,"props":2962,"children":2963},{"style":1067},[2964],{"type":998,"value":1070},{"type":993,"tag":1026,"props":2966,"children":2967},{"style":1073},[2968],{"type":998,"value":2969},"\"2. Read mode ('r') - reads file content\"",{"type":993,"tag":1026,"props":2971,"children":2972},{"style":1067},[2973],{"type":998,"value":1091},{"type":993,"tag":1026,"props":2975,"children":2976},{"class":1028,"line":136},[2977,2981,2985,2989,2993,2997,3001,3005],{"type":993,"tag":1026,"props":2978,"children":2979},{"style":1055},[2980],{"type":998,"value":2418},{"type":993,"tag":1026,"props":2982,"children":2983},{"style":1061},[2984],{"type":998,"value":1064},{"type":993,"tag":1026,"props":2986,"children":2987},{"style":1067},[2988],{"type":998,"value":1591},{"type":993,"tag":1026,"props":2990,"children":2991},{"style":1073},[2992],{"type":998,"value":1177},{"type":993,"tag":1026,"props":2994,"children":2995},{"style":1067},[2996],{"type":998,"value":1310},{"type":993,"tag":1026,"props":2998,"children":2999},{"style":1055},[3000],{"type":998,"value":1315},{"type":993,"tag":1026,"props":3002,"children":3003},{"style":1049},[3004],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3006,"children":3007},{"style":1067},[3008],{"type":998,"value":1324},{"type":993,"tag":1026,"props":3010,"children":3011},{"class":1028,"line":146},[3012,3016,3020,3024],{"type":993,"tag":1026,"props":3013,"children":3014},{"style":1067},[3015],{"type":998,"value":2454},{"type":993,"tag":1026,"props":3017,"children":3018},{"style":1055},[3019],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3021,"children":3022},{"style":1049},[3023],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3025,"children":3026},{"style":1067},[3027],{"type":998,"value":1204},{"type":993,"tag":1026,"props":3029,"children":3030},{"class":1028,"line":155},[3031,3035,3039,3043,3048,3052,3056,3060,3064],{"type":993,"tag":1026,"props":3032,"children":3033},{"style":1061},[3034],{"type":998,"value":2474},{"type":993,"tag":1026,"props":3036,"children":3037},{"style":1067},[3038],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3040,"children":3041},{"style":1055},[3042],{"type":998,"value":1221},{"type":993,"tag":1026,"props":3044,"children":3045},{"style":1073},[3046],{"type":998,"value":3047},"\"Content:",{"type":993,"tag":1026,"props":3049,"children":3050},{"style":1061},[3051],{"type":998,"value":1812},{"type":993,"tag":1026,"props":3053,"children":3054},{"style":1067},[3055],{"type":998,"value":17},{"type":993,"tag":1026,"props":3057,"children":3058},{"style":1061},[3059],{"type":998,"value":1240},{"type":993,"tag":1026,"props":3061,"children":3062},{"style":1073},[3063],{"type":998,"value":1245},{"type":993,"tag":1026,"props":3065,"children":3066},{"style":1067},[3067],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3069,"children":3070},{"class":1028,"line":164},[3071],{"type":993,"tag":1026,"props":3072,"children":3073},{"style":1067},[3074],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3076,"children":3077},{"class":1028,"line":173},[3078],{"type":993,"tag":1026,"props":3079,"children":3080},{"style":1032},[3081],{"type":998,"value":3082},"    # Append mode - adds to end of file\n",{"type":993,"tag":1026,"props":3084,"children":3085},{"class":1028,"line":182},[3086,3090,3094,3099],{"type":993,"tag":1026,"props":3087,"children":3088},{"style":1061},[3089],{"type":998,"value":1495},{"type":993,"tag":1026,"props":3091,"children":3092},{"style":1067},[3093],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3095,"children":3096},{"style":1073},[3097],{"type":998,"value":3098},"\"3. Append mode ('a') - adds to end\"",{"type":993,"tag":1026,"props":3100,"children":3101},{"style":1067},[3102],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3104,"children":3105},{"class":1028,"line":191},[3106,3110,3114,3118,3122,3126,3130,3134],{"type":993,"tag":1026,"props":3107,"children":3108},{"style":1055},[3109],{"type":998,"value":2418},{"type":993,"tag":1026,"props":3111,"children":3112},{"style":1061},[3113],{"type":998,"value":1064},{"type":993,"tag":1026,"props":3115,"children":3116},{"style":1067},[3117],{"type":998,"value":1591},{"type":993,"tag":1026,"props":3119,"children":3120},{"style":1073},[3121],{"type":998,"value":1674},{"type":993,"tag":1026,"props":3123,"children":3124},{"style":1067},[3125],{"type":998,"value":1310},{"type":993,"tag":1026,"props":3127,"children":3128},{"style":1055},[3129],{"type":998,"value":1315},{"type":993,"tag":1026,"props":3131,"children":3132},{"style":1049},[3133],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3135,"children":3136},{"style":1067},[3137],{"type":998,"value":1324},{"type":993,"tag":1026,"props":3139,"children":3140},{"class":1028,"line":201},[3141,3145,3149,3154,3158,3162],{"type":993,"tag":1026,"props":3142,"children":3143},{"style":1049},[3144],{"type":998,"value":2889},{"type":993,"tag":1026,"props":3146,"children":3147},{"style":1067},[3148],{"type":998,"value":1103},{"type":993,"tag":1026,"props":3150,"children":3151},{"style":1073},[3152],{"type":998,"value":3153},"\"Line 3: Appended content",{"type":993,"tag":1026,"props":3155,"children":3156},{"style":1061},[3157],{"type":998,"value":1365},{"type":993,"tag":1026,"props":3159,"children":3160},{"style":1073},[3161],{"type":998,"value":1245},{"type":993,"tag":1026,"props":3163,"children":3164},{"style":1067},[3165],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3167,"children":3168},{"class":1028,"line":210},[3169],{"type":993,"tag":1026,"props":3170,"children":3171},{"style":1067},[3172],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3174,"children":3175},{"class":1028,"line":219},[3176],{"type":993,"tag":1026,"props":3177,"children":3178},{"style":1032},[3179],{"type":998,"value":3180},"    # Read updated file\n",{"type":993,"tag":1026,"props":3182,"children":3183},{"class":1028,"line":228},[3184,3188,3192,3196,3200,3204,3208,3212],{"type":993,"tag":1026,"props":3185,"children":3186},{"style":1055},[3187],{"type":998,"value":2418},{"type":993,"tag":1026,"props":3189,"children":3190},{"style":1061},[3191],{"type":998,"value":1064},{"type":993,"tag":1026,"props":3193,"children":3194},{"style":1067},[3195],{"type":998,"value":1591},{"type":993,"tag":1026,"props":3197,"children":3198},{"style":1073},[3199],{"type":998,"value":1177},{"type":993,"tag":1026,"props":3201,"children":3202},{"style":1067},[3203],{"type":998,"value":1310},{"type":993,"tag":1026,"props":3205,"children":3206},{"style":1055},[3207],{"type":998,"value":1315},{"type":993,"tag":1026,"props":3209,"children":3210},{"style":1049},[3211],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3213,"children":3214},{"style":1067},[3215],{"type":998,"value":1324},{"type":993,"tag":1026,"props":3217,"children":3218},{"class":1028,"line":238},[3219,3224,3228,3232],{"type":993,"tag":1026,"props":3220,"children":3221},{"style":1067},[3222],{"type":998,"value":3223},"        updated_content ",{"type":993,"tag":1026,"props":3225,"children":3226},{"style":1055},[3227],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3229,"children":3230},{"style":1049},[3231],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3233,"children":3234},{"style":1067},[3235],{"type":998,"value":1204},{"type":993,"tag":1026,"props":3237,"children":3238},{"class":1028,"line":247},[3239,3243,3247,3251,3256,3260,3265,3269,3273],{"type":993,"tag":1026,"props":3240,"children":3241},{"style":1061},[3242],{"type":998,"value":2474},{"type":993,"tag":1026,"props":3244,"children":3245},{"style":1067},[3246],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3248,"children":3249},{"style":1055},[3250],{"type":998,"value":1221},{"type":993,"tag":1026,"props":3252,"children":3253},{"style":1073},[3254],{"type":998,"value":3255},"\"Updated content:",{"type":993,"tag":1026,"props":3257,"children":3258},{"style":1061},[3259],{"type":998,"value":1812},{"type":993,"tag":1026,"props":3261,"children":3262},{"style":1067},[3263],{"type":998,"value":3264},"updated_content",{"type":993,"tag":1026,"props":3266,"children":3267},{"style":1061},[3268],{"type":998,"value":1240},{"type":993,"tag":1026,"props":3270,"children":3271},{"style":1073},[3272],{"type":998,"value":1245},{"type":993,"tag":1026,"props":3274,"children":3275},{"style":1067},[3276],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3278,"children":3279},{"class":1028,"line":256},[3280],{"type":993,"tag":1026,"props":3281,"children":3282},{"style":1067},[3283],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3285,"children":3286},{"class":1028,"line":265},[3287],{"type":993,"tag":1026,"props":3288,"children":3289},{"style":1032},[3290],{"type":998,"value":3291},"    # Read and write mode\n",{"type":993,"tag":1026,"props":3293,"children":3294},{"class":1028,"line":274},[3295,3299,3303,3308],{"type":993,"tag":1026,"props":3296,"children":3297},{"style":1061},[3298],{"type":998,"value":1495},{"type":993,"tag":1026,"props":3300,"children":3301},{"style":1067},[3302],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3304,"children":3305},{"style":1073},[3306],{"type":998,"value":3307},"\"4. Read/write mode ('r+') - read and modify\"",{"type":993,"tag":1026,"props":3309,"children":3310},{"style":1067},[3311],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3313,"children":3314},{"class":1028,"line":284},[3315,3319,3323,3327,3332,3336,3340,3344],{"type":993,"tag":1026,"props":3316,"children":3317},{"style":1055},[3318],{"type":998,"value":2418},{"type":993,"tag":1026,"props":3320,"children":3321},{"style":1061},[3322],{"type":998,"value":1064},{"type":993,"tag":1026,"props":3324,"children":3325},{"style":1067},[3326],{"type":998,"value":1591},{"type":993,"tag":1026,"props":3328,"children":3329},{"style":1073},[3330],{"type":998,"value":3331},"\"r+\"",{"type":993,"tag":1026,"props":3333,"children":3334},{"style":1067},[3335],{"type":998,"value":1310},{"type":993,"tag":1026,"props":3337,"children":3338},{"style":1055},[3339],{"type":998,"value":1315},{"type":993,"tag":1026,"props":3341,"children":3342},{"style":1049},[3343],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3345,"children":3346},{"style":1067},[3347],{"type":998,"value":1324},{"type":993,"tag":1026,"props":3349,"children":3350},{"class":1028,"line":293},[3351],{"type":993,"tag":1026,"props":3352,"children":3353},{"style":1032},[3354],{"type":998,"value":3355},"        # Read current content\n",{"type":993,"tag":1026,"props":3357,"children":3358},{"class":1028,"line":302},[3359,3363,3367,3371],{"type":993,"tag":1026,"props":3360,"children":3361},{"style":1067},[3362],{"type":998,"value":2454},{"type":993,"tag":1026,"props":3364,"children":3365},{"style":1055},[3366],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3368,"children":3369},{"style":1049},[3370],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3372,"children":3373},{"style":1067},[3374],{"type":998,"value":1204},{"type":993,"tag":1026,"props":3376,"children":3377},{"class":1028,"line":311},[3378],{"type":993,"tag":1026,"props":3379,"children":3380},{"style":1032},[3381],{"type":998,"value":3382},"        # Go back to beginning\n",{"type":993,"tag":1026,"props":3384,"children":3385},{"class":1028,"line":320},[3386,3390,3395,3400],{"type":993,"tag":1026,"props":3387,"children":3388},{"style":1049},[3389],{"type":998,"value":2889},{"type":993,"tag":1026,"props":3391,"children":3392},{"style":1067},[3393],{"type":998,"value":3394},".seek(",{"type":993,"tag":1026,"props":3396,"children":3397},{"style":1061},[3398],{"type":998,"value":3399},"0",{"type":993,"tag":1026,"props":3401,"children":3402},{"style":1067},[3403],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3405,"children":3406},{"class":1028,"line":329},[3407],{"type":993,"tag":1026,"props":3408,"children":3409},{"style":1032},[3410],{"type":998,"value":3411},"        # Write new content\n",{"type":993,"tag":1026,"props":3413,"children":3414},{"class":1028,"line":338},[3415,3419,3423,3428,3433],{"type":993,"tag":1026,"props":3416,"children":3417},{"style":1049},[3418],{"type":998,"value":2889},{"type":993,"tag":1026,"props":3420,"children":3421},{"style":1067},[3422],{"type":998,"value":1103},{"type":993,"tag":1026,"props":3424,"children":3425},{"style":1073},[3426],{"type":998,"value":3427},"\"Modified: \"",{"type":993,"tag":1026,"props":3429,"children":3430},{"style":1055},[3431],{"type":998,"value":3432}," +",{"type":993,"tag":1026,"props":3434,"children":3435},{"style":1067},[3436],{"type":998,"value":3437}," content)\n",{"type":993,"tag":1026,"props":3439,"children":3440},{"class":1028,"line":347},[3441,3445,3450],{"type":993,"tag":1026,"props":3442,"children":3443},{"style":1049},[3444],{"type":998,"value":2889},{"type":993,"tag":1026,"props":3446,"children":3447},{"style":1067},[3448],{"type":998,"value":3449},".truncate()  ",{"type":993,"tag":1026,"props":3451,"children":3452},{"style":1032},[3453],{"type":998,"value":3454},"# Remove any remaining old content\n",{"type":993,"tag":1026,"props":3456,"children":3457},{"class":1028,"line":356},[3458],{"type":993,"tag":1026,"props":3459,"children":3460},{"style":1067},[3461],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3463,"children":3464},{"class":1028,"line":365},[3465],{"type":993,"tag":1026,"props":3466,"children":3467},{"style":1032},[3468],{"type":998,"value":3469},"    # Show final result\n",{"type":993,"tag":1026,"props":3471,"children":3472},{"class":1028,"line":374},[3473,3477,3481,3485,3489,3493,3497,3501],{"type":993,"tag":1026,"props":3474,"children":3475},{"style":1055},[3476],{"type":998,"value":2418},{"type":993,"tag":1026,"props":3478,"children":3479},{"style":1061},[3480],{"type":998,"value":1064},{"type":993,"tag":1026,"props":3482,"children":3483},{"style":1067},[3484],{"type":998,"value":1591},{"type":993,"tag":1026,"props":3486,"children":3487},{"style":1073},[3488],{"type":998,"value":1177},{"type":993,"tag":1026,"props":3490,"children":3491},{"style":1067},[3492],{"type":998,"value":1310},{"type":993,"tag":1026,"props":3494,"children":3495},{"style":1055},[3496],{"type":998,"value":1315},{"type":993,"tag":1026,"props":3498,"children":3499},{"style":1049},[3500],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3502,"children":3503},{"style":1067},[3504],{"type":998,"value":1324},{"type":993,"tag":1026,"props":3506,"children":3507},{"class":1028,"line":384},[3508,3513,3517,3521],{"type":993,"tag":1026,"props":3509,"children":3510},{"style":1067},[3511],{"type":998,"value":3512},"        final_content ",{"type":993,"tag":1026,"props":3514,"children":3515},{"style":1055},[3516],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3518,"children":3519},{"style":1049},[3520],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3522,"children":3523},{"style":1067},[3524],{"type":998,"value":1204},{"type":993,"tag":1026,"props":3526,"children":3527},{"class":1028,"line":393},[3528,3532,3536,3540,3544,3548,3553,3557,3561],{"type":993,"tag":1026,"props":3529,"children":3530},{"style":1061},[3531],{"type":998,"value":2474},{"type":993,"tag":1026,"props":3533,"children":3534},{"style":1067},[3535],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3537,"children":3538},{"style":1055},[3539],{"type":998,"value":1221},{"type":993,"tag":1026,"props":3541,"children":3542},{"style":1073},[3543],{"type":998,"value":1807},{"type":993,"tag":1026,"props":3545,"children":3546},{"style":1061},[3547],{"type":998,"value":1812},{"type":993,"tag":1026,"props":3549,"children":3550},{"style":1067},[3551],{"type":998,"value":3552},"final_content",{"type":993,"tag":1026,"props":3554,"children":3555},{"style":1061},[3556],{"type":998,"value":1240},{"type":993,"tag":1026,"props":3558,"children":3559},{"style":1073},[3560],{"type":998,"value":1245},{"type":993,"tag":1026,"props":3562,"children":3563},{"style":1067},[3564],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3566,"children":3567},{"class":1028,"line":402},[3568],{"type":993,"tag":1026,"props":3569,"children":3570},{"emptyLinePlaceholder":13},[3571],{"type":998,"value":1137},{"type":993,"tag":1026,"props":3573,"children":3574},{"class":1028,"line":411},[3575],{"type":993,"tag":1026,"props":3576,"children":3577},{"style":1067},[3578],{"type":998,"value":3579},"file_mode_examples()\n",{"type":993,"tag":1830,"props":3581,"children":3583},{"id":3582},"text-encoding-and-binary-files",[3584],{"type":998,"value":3585},"⚡ Text Encoding and Binary Files",{"type":993,"tag":1001,"props":3587,"children":3588},{},[3589],{"type":998,"value":3590},"Understanding text encoding and binary file handling ensures your programs work with different file types correctly.",{"type":993,"tag":1012,"props":3592,"children":3593},{},[3594],{"type":993,"tag":1016,"props":3595,"children":3597},{"className":1018,"code":3596,"language":6,"meta":8,"style":8},"def encoding_and_binary_examples():\n    \"\"\"Demonstrate text encoding and binary file handling\"\"\"\n    \n    # Text file with encoding\n    print(\"1. Text files with encoding\")\n    text_content = \"Hello, World! 🌍\\nPython supports Unicode! 🐍\"\n    \n    # Save with UTF-8 encoding (recommended)\n    with open(\"unicode_text.txt\", \"w\", encoding=\"utf-8\") as file:\n        file.write(text_content)\n    \n    # Read with matching encoding\n    with open(\"unicode_text.txt\", \"r\", encoding=\"utf-8\") as file:\n        content = file.read()\n        print(f\"Unicode content: {content}\")\n    \n    # Binary file example\n    print(\"\\n2. Binary file handling\")\n    binary_data = b\"This is binary data: \\x00\\x01\\x02\\x03\"\n    \n    # Write binary data\n    with open(\"binary_file.bin\", \"wb\") as file:\n        file.write(binary_data)\n    \n    # Read binary data\n    with open(\"binary_file.bin\", \"rb\") as file:\n        read_data = file.read()\n        print(f\"Binary data: {read_data}\")\n        print(f\"Data type: {type(read_data)}\")\n    \n    # Working with different encodings\n    print(\"\\n3. Different text encodings\")\n    \n    # Create text with special characters\n    special_text = \"Café, naïve, résumé\"\n    \n    # Save with different encodings\n    encodings = [\"utf-8\", \"latin-1\", \"ascii\"]\n    \n    for encoding in encodings:\n        try:\n            filename = f\"text_{encoding}.txt\"\n            with open(filename, \"w\", encoding=encoding) as file:\n                file.write(special_text)\n            \n            # Read back\n            with open(filename, \"r\", encoding=encoding) as file:\n                content = file.read()\n                print(f\"{encoding}: {content}\")\n        \n        except UnicodeEncodeError:\n            print(f\"{encoding}: Cannot encode special characters\")\n        except UnicodeDecodeError:\n            print(f\"{encoding}: Cannot decode file\")\n\nencoding_and_binary_examples()\n",[3598],{"type":993,"tag":1022,"props":3599,"children":3600},{"__ignoreMap":8},[3601,3617,3625,3632,3640,3660,3686,3693,3701,3763,3775,3782,3790,3849,3868,3908,3915,3923,3951,3983,3990,3998,4043,4055,4062,4070,4114,4134,4175,4217,4224,4232,4260,4267,4275,4292,4299,4307,4351,4358,4381,4393,4432,4481,4494,4502,4510,4557,4577,4634,4642,4659,4700,4716,4756,4763],{"type":993,"tag":1026,"props":3602,"children":3603},{"class":1028,"line":12},[3604,3608,3613],{"type":993,"tag":1026,"props":3605,"children":3606},{"style":1055},[3607],{"type":998,"value":2161},{"type":993,"tag":1026,"props":3609,"children":3610},{"style":2164},[3611],{"type":998,"value":3612}," encoding_and_binary_examples",{"type":993,"tag":1026,"props":3614,"children":3615},{"style":1067},[3616],{"type":998,"value":2172},{"type":993,"tag":1026,"props":3618,"children":3619},{"class":1028,"line":27},[3620],{"type":993,"tag":1026,"props":3621,"children":3622},{"style":1073},[3623],{"type":998,"value":3624},"    \"\"\"Demonstrate text encoding and binary file handling\"\"\"\n",{"type":993,"tag":1026,"props":3626,"children":3627},{"class":1028,"line":36},[3628],{"type":993,"tag":1026,"props":3629,"children":3630},{"style":1067},[3631],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3633,"children":3634},{"class":1028,"line":45},[3635],{"type":993,"tag":1026,"props":3636,"children":3637},{"style":1032},[3638],{"type":998,"value":3639},"    # Text file with encoding\n",{"type":993,"tag":1026,"props":3641,"children":3642},{"class":1028,"line":54},[3643,3647,3651,3656],{"type":993,"tag":1026,"props":3644,"children":3645},{"style":1061},[3646],{"type":998,"value":1495},{"type":993,"tag":1026,"props":3648,"children":3649},{"style":1067},[3650],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3652,"children":3653},{"style":1073},[3654],{"type":998,"value":3655},"\"1. Text files with encoding\"",{"type":993,"tag":1026,"props":3657,"children":3658},{"style":1067},[3659],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3661,"children":3662},{"class":1028,"line":63},[3663,3668,3672,3677,3681],{"type":993,"tag":1026,"props":3664,"children":3665},{"style":1067},[3666],{"type":998,"value":3667},"    text_content ",{"type":993,"tag":1026,"props":3669,"children":3670},{"style":1055},[3671],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3673,"children":3674},{"style":1073},[3675],{"type":998,"value":3676}," \"Hello, World! 🌍",{"type":993,"tag":1026,"props":3678,"children":3679},{"style":1061},[3680],{"type":998,"value":1365},{"type":993,"tag":1026,"props":3682,"children":3683},{"style":1073},[3684],{"type":998,"value":3685},"Python supports Unicode! 🐍\"\n",{"type":993,"tag":1026,"props":3687,"children":3688},{"class":1028,"line":72},[3689],{"type":993,"tag":1026,"props":3690,"children":3691},{"style":1067},[3692],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3694,"children":3695},{"class":1028,"line":81},[3696],{"type":993,"tag":1026,"props":3697,"children":3698},{"style":1032},[3699],{"type":998,"value":3700},"    # Save with UTF-8 encoding (recommended)\n",{"type":993,"tag":1026,"props":3702,"children":3703},{"class":1028,"line":91},[3704,3708,3712,3716,3721,3725,3729,3733,3738,3742,3747,3751,3755,3759],{"type":993,"tag":1026,"props":3705,"children":3706},{"style":1055},[3707],{"type":998,"value":2418},{"type":993,"tag":1026,"props":3709,"children":3710},{"style":1061},[3711],{"type":998,"value":1064},{"type":993,"tag":1026,"props":3713,"children":3714},{"style":1067},[3715],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3717,"children":3718},{"style":1073},[3719],{"type":998,"value":3720},"\"unicode_text.txt\"",{"type":993,"tag":1026,"props":3722,"children":3723},{"style":1067},[3724],{"type":998,"value":1081},{"type":993,"tag":1026,"props":3726,"children":3727},{"style":1073},[3728],{"type":998,"value":1086},{"type":993,"tag":1026,"props":3730,"children":3731},{"style":1067},[3732],{"type":998,"value":1081},{"type":993,"tag":1026,"props":3734,"children":3735},{"style":1049},[3736],{"type":998,"value":3737},"encoding",{"type":993,"tag":1026,"props":3739,"children":3740},{"style":1055},[3741],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3743,"children":3744},{"style":1073},[3745],{"type":998,"value":3746},"\"utf-8\"",{"type":993,"tag":1026,"props":3748,"children":3749},{"style":1067},[3750],{"type":998,"value":1310},{"type":993,"tag":1026,"props":3752,"children":3753},{"style":1055},[3754],{"type":998,"value":1315},{"type":993,"tag":1026,"props":3756,"children":3757},{"style":1049},[3758],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3760,"children":3761},{"style":1067},[3762],{"type":998,"value":1324},{"type":993,"tag":1026,"props":3764,"children":3765},{"class":1028,"line":100},[3766,3770],{"type":993,"tag":1026,"props":3767,"children":3768},{"style":1049},[3769],{"type":998,"value":2889},{"type":993,"tag":1026,"props":3771,"children":3772},{"style":1067},[3773],{"type":998,"value":3774},".write(text_content)\n",{"type":993,"tag":1026,"props":3776,"children":3777},{"class":1028,"line":109},[3778],{"type":993,"tag":1026,"props":3779,"children":3780},{"style":1067},[3781],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3783,"children":3784},{"class":1028,"line":118},[3785],{"type":993,"tag":1026,"props":3786,"children":3787},{"style":1032},[3788],{"type":998,"value":3789},"    # Read with matching encoding\n",{"type":993,"tag":1026,"props":3791,"children":3792},{"class":1028,"line":127},[3793,3797,3801,3805,3809,3813,3817,3821,3825,3829,3833,3837,3841,3845],{"type":993,"tag":1026,"props":3794,"children":3795},{"style":1055},[3796],{"type":998,"value":2418},{"type":993,"tag":1026,"props":3798,"children":3799},{"style":1061},[3800],{"type":998,"value":1064},{"type":993,"tag":1026,"props":3802,"children":3803},{"style":1067},[3804],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3806,"children":3807},{"style":1073},[3808],{"type":998,"value":3720},{"type":993,"tag":1026,"props":3810,"children":3811},{"style":1067},[3812],{"type":998,"value":1081},{"type":993,"tag":1026,"props":3814,"children":3815},{"style":1073},[3816],{"type":998,"value":1177},{"type":993,"tag":1026,"props":3818,"children":3819},{"style":1067},[3820],{"type":998,"value":1081},{"type":993,"tag":1026,"props":3822,"children":3823},{"style":1049},[3824],{"type":998,"value":3737},{"type":993,"tag":1026,"props":3826,"children":3827},{"style":1055},[3828],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3830,"children":3831},{"style":1073},[3832],{"type":998,"value":3746},{"type":993,"tag":1026,"props":3834,"children":3835},{"style":1067},[3836],{"type":998,"value":1310},{"type":993,"tag":1026,"props":3838,"children":3839},{"style":1055},[3840],{"type":998,"value":1315},{"type":993,"tag":1026,"props":3842,"children":3843},{"style":1049},[3844],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3846,"children":3847},{"style":1067},[3848],{"type":998,"value":1324},{"type":993,"tag":1026,"props":3850,"children":3851},{"class":1028,"line":136},[3852,3856,3860,3864],{"type":993,"tag":1026,"props":3853,"children":3854},{"style":1067},[3855],{"type":998,"value":2454},{"type":993,"tag":1026,"props":3857,"children":3858},{"style":1055},[3859],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3861,"children":3862},{"style":1049},[3863],{"type":998,"value":1199},{"type":993,"tag":1026,"props":3865,"children":3866},{"style":1067},[3867],{"type":998,"value":1204},{"type":993,"tag":1026,"props":3869,"children":3870},{"class":1028,"line":146},[3871,3875,3879,3883,3888,3892,3896,3900,3904],{"type":993,"tag":1026,"props":3872,"children":3873},{"style":1061},[3874],{"type":998,"value":2474},{"type":993,"tag":1026,"props":3876,"children":3877},{"style":1067},[3878],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3880,"children":3881},{"style":1055},[3882],{"type":998,"value":1221},{"type":993,"tag":1026,"props":3884,"children":3885},{"style":1073},[3886],{"type":998,"value":3887},"\"Unicode content: ",{"type":993,"tag":1026,"props":3889,"children":3890},{"style":1061},[3891],{"type":998,"value":1231},{"type":993,"tag":1026,"props":3893,"children":3894},{"style":1067},[3895],{"type":998,"value":17},{"type":993,"tag":1026,"props":3897,"children":3898},{"style":1061},[3899],{"type":998,"value":1240},{"type":993,"tag":1026,"props":3901,"children":3902},{"style":1073},[3903],{"type":998,"value":1245},{"type":993,"tag":1026,"props":3905,"children":3906},{"style":1067},[3907],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3909,"children":3910},{"class":1028,"line":155},[3911],{"type":993,"tag":1026,"props":3912,"children":3913},{"style":1067},[3914],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3916,"children":3917},{"class":1028,"line":164},[3918],{"type":993,"tag":1026,"props":3919,"children":3920},{"style":1032},[3921],{"type":998,"value":3922},"    # Binary file example\n",{"type":993,"tag":1026,"props":3924,"children":3925},{"class":1028,"line":173},[3926,3930,3934,3938,3942,3947],{"type":993,"tag":1026,"props":3927,"children":3928},{"style":1061},[3929],{"type":998,"value":1495},{"type":993,"tag":1026,"props":3931,"children":3932},{"style":1067},[3933],{"type":998,"value":1070},{"type":993,"tag":1026,"props":3935,"children":3936},{"style":1073},[3937],{"type":998,"value":1245},{"type":993,"tag":1026,"props":3939,"children":3940},{"style":1061},[3941],{"type":998,"value":1365},{"type":993,"tag":1026,"props":3943,"children":3944},{"style":1073},[3945],{"type":998,"value":3946},"2. Binary file handling\"",{"type":993,"tag":1026,"props":3948,"children":3949},{"style":1067},[3950],{"type":998,"value":1091},{"type":993,"tag":1026,"props":3952,"children":3953},{"class":1028,"line":182},[3954,3959,3963,3968,3973,3978],{"type":993,"tag":1026,"props":3955,"children":3956},{"style":1067},[3957],{"type":998,"value":3958},"    binary_data ",{"type":993,"tag":1026,"props":3960,"children":3961},{"style":1055},[3962],{"type":998,"value":1194},{"type":993,"tag":1026,"props":3964,"children":3965},{"style":1055},[3966],{"type":998,"value":3967}," b",{"type":993,"tag":1026,"props":3969,"children":3970},{"style":1073},[3971],{"type":998,"value":3972},"\"This is binary data: ",{"type":993,"tag":1026,"props":3974,"children":3975},{"style":1061},[3976],{"type":998,"value":3977},"\\x00\\x01\\x02\\x03",{"type":993,"tag":1026,"props":3979,"children":3980},{"style":1073},[3981],{"type":998,"value":3982},"\"\n",{"type":993,"tag":1026,"props":3984,"children":3985},{"class":1028,"line":191},[3986],{"type":993,"tag":1026,"props":3987,"children":3988},{"style":1067},[3989],{"type":998,"value":2188},{"type":993,"tag":1026,"props":3991,"children":3992},{"class":1028,"line":201},[3993],{"type":993,"tag":1026,"props":3994,"children":3995},{"style":1032},[3996],{"type":998,"value":3997},"    # Write binary data\n",{"type":993,"tag":1026,"props":3999,"children":4000},{"class":1028,"line":210},[4001,4005,4009,4013,4018,4022,4027,4031,4035,4039],{"type":993,"tag":1026,"props":4002,"children":4003},{"style":1055},[4004],{"type":998,"value":2418},{"type":993,"tag":1026,"props":4006,"children":4007},{"style":1061},[4008],{"type":998,"value":1064},{"type":993,"tag":1026,"props":4010,"children":4011},{"style":1067},[4012],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4014,"children":4015},{"style":1073},[4016],{"type":998,"value":4017},"\"binary_file.bin\"",{"type":993,"tag":1026,"props":4019,"children":4020},{"style":1067},[4021],{"type":998,"value":1081},{"type":993,"tag":1026,"props":4023,"children":4024},{"style":1073},[4025],{"type":998,"value":4026},"\"wb\"",{"type":993,"tag":1026,"props":4028,"children":4029},{"style":1067},[4030],{"type":998,"value":1310},{"type":993,"tag":1026,"props":4032,"children":4033},{"style":1055},[4034],{"type":998,"value":1315},{"type":993,"tag":1026,"props":4036,"children":4037},{"style":1049},[4038],{"type":998,"value":1199},{"type":993,"tag":1026,"props":4040,"children":4041},{"style":1067},[4042],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4044,"children":4045},{"class":1028,"line":219},[4046,4050],{"type":993,"tag":1026,"props":4047,"children":4048},{"style":1049},[4049],{"type":998,"value":2889},{"type":993,"tag":1026,"props":4051,"children":4052},{"style":1067},[4053],{"type":998,"value":4054},".write(binary_data)\n",{"type":993,"tag":1026,"props":4056,"children":4057},{"class":1028,"line":228},[4058],{"type":993,"tag":1026,"props":4059,"children":4060},{"style":1067},[4061],{"type":998,"value":2188},{"type":993,"tag":1026,"props":4063,"children":4064},{"class":1028,"line":238},[4065],{"type":993,"tag":1026,"props":4066,"children":4067},{"style":1032},[4068],{"type":998,"value":4069},"    # Read binary data\n",{"type":993,"tag":1026,"props":4071,"children":4072},{"class":1028,"line":247},[4073,4077,4081,4085,4089,4093,4098,4102,4106,4110],{"type":993,"tag":1026,"props":4074,"children":4075},{"style":1055},[4076],{"type":998,"value":2418},{"type":993,"tag":1026,"props":4078,"children":4079},{"style":1061},[4080],{"type":998,"value":1064},{"type":993,"tag":1026,"props":4082,"children":4083},{"style":1067},[4084],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4086,"children":4087},{"style":1073},[4088],{"type":998,"value":4017},{"type":993,"tag":1026,"props":4090,"children":4091},{"style":1067},[4092],{"type":998,"value":1081},{"type":993,"tag":1026,"props":4094,"children":4095},{"style":1073},[4096],{"type":998,"value":4097},"\"rb\"",{"type":993,"tag":1026,"props":4099,"children":4100},{"style":1067},[4101],{"type":998,"value":1310},{"type":993,"tag":1026,"props":4103,"children":4104},{"style":1055},[4105],{"type":998,"value":1315},{"type":993,"tag":1026,"props":4107,"children":4108},{"style":1049},[4109],{"type":998,"value":1199},{"type":993,"tag":1026,"props":4111,"children":4112},{"style":1067},[4113],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4115,"children":4116},{"class":1028,"line":256},[4117,4122,4126,4130],{"type":993,"tag":1026,"props":4118,"children":4119},{"style":1067},[4120],{"type":998,"value":4121},"        read_data ",{"type":993,"tag":1026,"props":4123,"children":4124},{"style":1055},[4125],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4127,"children":4128},{"style":1049},[4129],{"type":998,"value":1199},{"type":993,"tag":1026,"props":4131,"children":4132},{"style":1067},[4133],{"type":998,"value":1204},{"type":993,"tag":1026,"props":4135,"children":4136},{"class":1028,"line":265},[4137,4141,4145,4149,4154,4158,4163,4167,4171],{"type":993,"tag":1026,"props":4138,"children":4139},{"style":1061},[4140],{"type":998,"value":2474},{"type":993,"tag":1026,"props":4142,"children":4143},{"style":1067},[4144],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4146,"children":4147},{"style":1055},[4148],{"type":998,"value":1221},{"type":993,"tag":1026,"props":4150,"children":4151},{"style":1073},[4152],{"type":998,"value":4153},"\"Binary data: ",{"type":993,"tag":1026,"props":4155,"children":4156},{"style":1061},[4157],{"type":998,"value":1231},{"type":993,"tag":1026,"props":4159,"children":4160},{"style":1067},[4161],{"type":998,"value":4162},"read_data",{"type":993,"tag":1026,"props":4164,"children":4165},{"style":1061},[4166],{"type":998,"value":1240},{"type":993,"tag":1026,"props":4168,"children":4169},{"style":1073},[4170],{"type":998,"value":1245},{"type":993,"tag":1026,"props":4172,"children":4173},{"style":1067},[4174],{"type":998,"value":1091},{"type":993,"tag":1026,"props":4176,"children":4177},{"class":1028,"line":274},[4178,4182,4186,4190,4195,4200,4205,4209,4213],{"type":993,"tag":1026,"props":4179,"children":4180},{"style":1061},[4181],{"type":998,"value":2474},{"type":993,"tag":1026,"props":4183,"children":4184},{"style":1067},[4185],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4187,"children":4188},{"style":1055},[4189],{"type":998,"value":1221},{"type":993,"tag":1026,"props":4191,"children":4192},{"style":1073},[4193],{"type":998,"value":4194},"\"Data type: ",{"type":993,"tag":1026,"props":4196,"children":4197},{"style":1061},[4198],{"type":998,"value":4199},"{type",{"type":993,"tag":1026,"props":4201,"children":4202},{"style":1067},[4203],{"type":998,"value":4204},"(read_data)",{"type":993,"tag":1026,"props":4206,"children":4207},{"style":1061},[4208],{"type":998,"value":1240},{"type":993,"tag":1026,"props":4210,"children":4211},{"style":1073},[4212],{"type":998,"value":1245},{"type":993,"tag":1026,"props":4214,"children":4215},{"style":1067},[4216],{"type":998,"value":1091},{"type":993,"tag":1026,"props":4218,"children":4219},{"class":1028,"line":284},[4220],{"type":993,"tag":1026,"props":4221,"children":4222},{"style":1067},[4223],{"type":998,"value":2188},{"type":993,"tag":1026,"props":4225,"children":4226},{"class":1028,"line":293},[4227],{"type":993,"tag":1026,"props":4228,"children":4229},{"style":1032},[4230],{"type":998,"value":4231},"    # Working with different encodings\n",{"type":993,"tag":1026,"props":4233,"children":4234},{"class":1028,"line":302},[4235,4239,4243,4247,4251,4256],{"type":993,"tag":1026,"props":4236,"children":4237},{"style":1061},[4238],{"type":998,"value":1495},{"type":993,"tag":1026,"props":4240,"children":4241},{"style":1067},[4242],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4244,"children":4245},{"style":1073},[4246],{"type":998,"value":1245},{"type":993,"tag":1026,"props":4248,"children":4249},{"style":1061},[4250],{"type":998,"value":1365},{"type":993,"tag":1026,"props":4252,"children":4253},{"style":1073},[4254],{"type":998,"value":4255},"3. Different text encodings\"",{"type":993,"tag":1026,"props":4257,"children":4258},{"style":1067},[4259],{"type":998,"value":1091},{"type":993,"tag":1026,"props":4261,"children":4262},{"class":1028,"line":311},[4263],{"type":993,"tag":1026,"props":4264,"children":4265},{"style":1067},[4266],{"type":998,"value":2188},{"type":993,"tag":1026,"props":4268,"children":4269},{"class":1028,"line":320},[4270],{"type":993,"tag":1026,"props":4271,"children":4272},{"style":1032},[4273],{"type":998,"value":4274},"    # Create text with special characters\n",{"type":993,"tag":1026,"props":4276,"children":4277},{"class":1028,"line":329},[4278,4283,4287],{"type":993,"tag":1026,"props":4279,"children":4280},{"style":1067},[4281],{"type":998,"value":4282},"    special_text ",{"type":993,"tag":1026,"props":4284,"children":4285},{"style":1055},[4286],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4288,"children":4289},{"style":1073},[4290],{"type":998,"value":4291}," \"Café, naïve, résumé\"\n",{"type":993,"tag":1026,"props":4293,"children":4294},{"class":1028,"line":338},[4295],{"type":993,"tag":1026,"props":4296,"children":4297},{"style":1067},[4298],{"type":998,"value":2188},{"type":993,"tag":1026,"props":4300,"children":4301},{"class":1028,"line":347},[4302],{"type":993,"tag":1026,"props":4303,"children":4304},{"style":1032},[4305],{"type":998,"value":4306},"    # Save with different encodings\n",{"type":993,"tag":1026,"props":4308,"children":4309},{"class":1028,"line":356},[4310,4315,4319,4324,4328,4332,4337,4341,4346],{"type":993,"tag":1026,"props":4311,"children":4312},{"style":1067},[4313],{"type":998,"value":4314},"    encodings ",{"type":993,"tag":1026,"props":4316,"children":4317},{"style":1055},[4318],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4320,"children":4321},{"style":1067},[4322],{"type":998,"value":4323}," [",{"type":993,"tag":1026,"props":4325,"children":4326},{"style":1073},[4327],{"type":998,"value":3746},{"type":993,"tag":1026,"props":4329,"children":4330},{"style":1067},[4331],{"type":998,"value":1081},{"type":993,"tag":1026,"props":4333,"children":4334},{"style":1073},[4335],{"type":998,"value":4336},"\"latin-1\"",{"type":993,"tag":1026,"props":4338,"children":4339},{"style":1067},[4340],{"type":998,"value":1081},{"type":993,"tag":1026,"props":4342,"children":4343},{"style":1073},[4344],{"type":998,"value":4345},"\"ascii\"",{"type":993,"tag":1026,"props":4347,"children":4348},{"style":1067},[4349],{"type":998,"value":4350},"]\n",{"type":993,"tag":1026,"props":4352,"children":4353},{"class":1028,"line":365},[4354],{"type":993,"tag":1026,"props":4355,"children":4356},{"style":1067},[4357],{"type":998,"value":2188},{"type":993,"tag":1026,"props":4359,"children":4360},{"class":1028,"line":374},[4361,4366,4371,4376],{"type":993,"tag":1026,"props":4362,"children":4363},{"style":1055},[4364],{"type":998,"value":4365},"    for",{"type":993,"tag":1026,"props":4367,"children":4368},{"style":1067},[4369],{"type":998,"value":4370}," encoding ",{"type":993,"tag":1026,"props":4372,"children":4373},{"style":1055},[4374],{"type":998,"value":4375},"in",{"type":993,"tag":1026,"props":4377,"children":4378},{"style":1067},[4379],{"type":998,"value":4380}," encodings:\n",{"type":993,"tag":1026,"props":4382,"children":4383},{"class":1028,"line":384},[4384,4389],{"type":993,"tag":1026,"props":4385,"children":4386},{"style":1055},[4387],{"type":998,"value":4388},"        try",{"type":993,"tag":1026,"props":4390,"children":4391},{"style":1067},[4392],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4394,"children":4395},{"class":1028,"line":393},[4396,4401,4405,4410,4415,4419,4423,4427],{"type":993,"tag":1026,"props":4397,"children":4398},{"style":1067},[4399],{"type":998,"value":4400},"            filename ",{"type":993,"tag":1026,"props":4402,"children":4403},{"style":1055},[4404],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4406,"children":4407},{"style":1055},[4408],{"type":998,"value":4409}," f",{"type":993,"tag":1026,"props":4411,"children":4412},{"style":1073},[4413],{"type":998,"value":4414},"\"text_",{"type":993,"tag":1026,"props":4416,"children":4417},{"style":1061},[4418],{"type":998,"value":1231},{"type":993,"tag":1026,"props":4420,"children":4421},{"style":1067},[4422],{"type":998,"value":3737},{"type":993,"tag":1026,"props":4424,"children":4425},{"style":1061},[4426],{"type":998,"value":1240},{"type":993,"tag":1026,"props":4428,"children":4429},{"style":1073},[4430],{"type":998,"value":4431},".txt\"\n",{"type":993,"tag":1026,"props":4433,"children":4434},{"class":1028,"line":402},[4435,4440,4444,4448,4452,4456,4460,4464,4469,4473,4477],{"type":993,"tag":1026,"props":4436,"children":4437},{"style":1055},[4438],{"type":998,"value":4439},"            with",{"type":993,"tag":1026,"props":4441,"children":4442},{"style":1061},[4443],{"type":998,"value":1064},{"type":993,"tag":1026,"props":4445,"children":4446},{"style":1067},[4447],{"type":998,"value":1591},{"type":993,"tag":1026,"props":4449,"children":4450},{"style":1073},[4451],{"type":998,"value":1086},{"type":993,"tag":1026,"props":4453,"children":4454},{"style":1067},[4455],{"type":998,"value":1081},{"type":993,"tag":1026,"props":4457,"children":4458},{"style":1049},[4459],{"type":998,"value":3737},{"type":993,"tag":1026,"props":4461,"children":4462},{"style":1055},[4463],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4465,"children":4466},{"style":1067},[4467],{"type":998,"value":4468},"encoding) ",{"type":993,"tag":1026,"props":4470,"children":4471},{"style":1055},[4472],{"type":998,"value":1315},{"type":993,"tag":1026,"props":4474,"children":4475},{"style":1049},[4476],{"type":998,"value":1199},{"type":993,"tag":1026,"props":4478,"children":4479},{"style":1067},[4480],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4482,"children":4483},{"class":1028,"line":411},[4484,4489],{"type":993,"tag":1026,"props":4485,"children":4486},{"style":1049},[4487],{"type":998,"value":4488},"                file",{"type":993,"tag":1026,"props":4490,"children":4491},{"style":1067},[4492],{"type":998,"value":4493},".write(special_text)\n",{"type":993,"tag":1026,"props":4495,"children":4496},{"class":1028,"line":420},[4497],{"type":993,"tag":1026,"props":4498,"children":4499},{"style":1067},[4500],{"type":998,"value":4501},"            \n",{"type":993,"tag":1026,"props":4503,"children":4504},{"class":1028,"line":429},[4505],{"type":993,"tag":1026,"props":4506,"children":4507},{"style":1032},[4508],{"type":998,"value":4509},"            # Read back\n",{"type":993,"tag":1026,"props":4511,"children":4512},{"class":1028,"line":438},[4513,4517,4521,4525,4529,4533,4537,4541,4545,4549,4553],{"type":993,"tag":1026,"props":4514,"children":4515},{"style":1055},[4516],{"type":998,"value":4439},{"type":993,"tag":1026,"props":4518,"children":4519},{"style":1061},[4520],{"type":998,"value":1064},{"type":993,"tag":1026,"props":4522,"children":4523},{"style":1067},[4524],{"type":998,"value":1591},{"type":993,"tag":1026,"props":4526,"children":4527},{"style":1073},[4528],{"type":998,"value":1177},{"type":993,"tag":1026,"props":4530,"children":4531},{"style":1067},[4532],{"type":998,"value":1081},{"type":993,"tag":1026,"props":4534,"children":4535},{"style":1049},[4536],{"type":998,"value":3737},{"type":993,"tag":1026,"props":4538,"children":4539},{"style":1055},[4540],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4542,"children":4543},{"style":1067},[4544],{"type":998,"value":4468},{"type":993,"tag":1026,"props":4546,"children":4547},{"style":1055},[4548],{"type":998,"value":1315},{"type":993,"tag":1026,"props":4550,"children":4551},{"style":1049},[4552],{"type":998,"value":1199},{"type":993,"tag":1026,"props":4554,"children":4555},{"style":1067},[4556],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4558,"children":4559},{"class":1028,"line":447},[4560,4565,4569,4573],{"type":993,"tag":1026,"props":4561,"children":4562},{"style":1067},[4563],{"type":998,"value":4564},"                content ",{"type":993,"tag":1026,"props":4566,"children":4567},{"style":1055},[4568],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4570,"children":4571},{"style":1049},[4572],{"type":998,"value":1199},{"type":993,"tag":1026,"props":4574,"children":4575},{"style":1067},[4576],{"type":998,"value":1204},{"type":993,"tag":1026,"props":4578,"children":4579},{"class":1028,"line":457},[4580,4585,4589,4593,4597,4601,4605,4609,4614,4618,4622,4626,4630],{"type":993,"tag":1026,"props":4581,"children":4582},{"style":1061},[4583],{"type":998,"value":4584},"                print",{"type":993,"tag":1026,"props":4586,"children":4587},{"style":1067},[4588],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4590,"children":4591},{"style":1055},[4592],{"type":998,"value":1221},{"type":993,"tag":1026,"props":4594,"children":4595},{"style":1073},[4596],{"type":998,"value":1245},{"type":993,"tag":1026,"props":4598,"children":4599},{"style":1061},[4600],{"type":998,"value":1231},{"type":993,"tag":1026,"props":4602,"children":4603},{"style":1067},[4604],{"type":998,"value":3737},{"type":993,"tag":1026,"props":4606,"children":4607},{"style":1061},[4608],{"type":998,"value":1240},{"type":993,"tag":1026,"props":4610,"children":4611},{"style":1073},[4612],{"type":998,"value":4613},": ",{"type":993,"tag":1026,"props":4615,"children":4616},{"style":1061},[4617],{"type":998,"value":1231},{"type":993,"tag":1026,"props":4619,"children":4620},{"style":1067},[4621],{"type":998,"value":17},{"type":993,"tag":1026,"props":4623,"children":4624},{"style":1061},[4625],{"type":998,"value":1240},{"type":993,"tag":1026,"props":4627,"children":4628},{"style":1073},[4629],{"type":998,"value":1245},{"type":993,"tag":1026,"props":4631,"children":4632},{"style":1067},[4633],{"type":998,"value":1091},{"type":993,"tag":1026,"props":4635,"children":4636},{"class":1028,"line":466},[4637],{"type":993,"tag":1026,"props":4638,"children":4639},{"style":1067},[4640],{"type":998,"value":4641},"        \n",{"type":993,"tag":1026,"props":4643,"children":4644},{"class":1028,"line":475},[4645,4650,4655],{"type":993,"tag":1026,"props":4646,"children":4647},{"style":1055},[4648],{"type":998,"value":4649},"        except",{"type":993,"tag":1026,"props":4651,"children":4652},{"style":1061},[4653],{"type":998,"value":4654}," UnicodeEncodeError",{"type":993,"tag":1026,"props":4656,"children":4657},{"style":1067},[4658],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4660,"children":4661},{"class":1028,"line":484},[4662,4667,4671,4675,4679,4683,4687,4691,4696],{"type":993,"tag":1026,"props":4663,"children":4664},{"style":1061},[4665],{"type":998,"value":4666},"            print",{"type":993,"tag":1026,"props":4668,"children":4669},{"style":1067},[4670],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4672,"children":4673},{"style":1055},[4674],{"type":998,"value":1221},{"type":993,"tag":1026,"props":4676,"children":4677},{"style":1073},[4678],{"type":998,"value":1245},{"type":993,"tag":1026,"props":4680,"children":4681},{"style":1061},[4682],{"type":998,"value":1231},{"type":993,"tag":1026,"props":4684,"children":4685},{"style":1067},[4686],{"type":998,"value":3737},{"type":993,"tag":1026,"props":4688,"children":4689},{"style":1061},[4690],{"type":998,"value":1240},{"type":993,"tag":1026,"props":4692,"children":4693},{"style":1073},[4694],{"type":998,"value":4695},": Cannot encode special characters\"",{"type":993,"tag":1026,"props":4697,"children":4698},{"style":1067},[4699],{"type":998,"value":1091},{"type":993,"tag":1026,"props":4701,"children":4702},{"class":1028,"line":493},[4703,4707,4712],{"type":993,"tag":1026,"props":4704,"children":4705},{"style":1055},[4706],{"type":998,"value":4649},{"type":993,"tag":1026,"props":4708,"children":4709},{"style":1061},[4710],{"type":998,"value":4711}," UnicodeDecodeError",{"type":993,"tag":1026,"props":4713,"children":4714},{"style":1067},[4715],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4717,"children":4718},{"class":1028,"line":502},[4719,4723,4727,4731,4735,4739,4743,4747,4752],{"type":993,"tag":1026,"props":4720,"children":4721},{"style":1061},[4722],{"type":998,"value":4666},{"type":993,"tag":1026,"props":4724,"children":4725},{"style":1067},[4726],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4728,"children":4729},{"style":1055},[4730],{"type":998,"value":1221},{"type":993,"tag":1026,"props":4732,"children":4733},{"style":1073},[4734],{"type":998,"value":1245},{"type":993,"tag":1026,"props":4736,"children":4737},{"style":1061},[4738],{"type":998,"value":1231},{"type":993,"tag":1026,"props":4740,"children":4741},{"style":1067},[4742],{"type":998,"value":3737},{"type":993,"tag":1026,"props":4744,"children":4745},{"style":1061},[4746],{"type":998,"value":1240},{"type":993,"tag":1026,"props":4748,"children":4749},{"style":1073},[4750],{"type":998,"value":4751},": Cannot decode file\"",{"type":993,"tag":1026,"props":4753,"children":4754},{"style":1067},[4755],{"type":998,"value":1091},{"type":993,"tag":1026,"props":4757,"children":4758},{"class":1028,"line":511},[4759],{"type":993,"tag":1026,"props":4760,"children":4761},{"emptyLinePlaceholder":13},[4762],{"type":998,"value":1137},{"type":993,"tag":1026,"props":4764,"children":4765},{"class":1028,"line":520},[4766],{"type":993,"tag":1026,"props":4767,"children":4768},{"style":1067},[4769],{"type":998,"value":4770},"encoding_and_binary_examples()\n",{"type":993,"tag":1830,"props":4772,"children":4774},{"id":4773},"file-error-handling",[4775],{"type":998,"value":4776},"🚀 File Error Handling",{"type":993,"tag":1001,"props":4778,"children":4779},{},[4780],{"type":998,"value":4781},"Proper error handling ensures your programs can deal with file-related problems gracefully.",{"type":993,"tag":1012,"props":4783,"children":4784},{},[4785],{"type":993,"tag":1016,"props":4786,"children":4788},{"className":1018,"code":4787,"language":6,"meta":8,"style":8},"import os\n\ndef file_error_handling_examples():\n    \"\"\"Demonstrate comprehensive file error handling\"\"\"\n    \n    def safe_file_read(filename):\n        \"\"\"Safely read file with comprehensive error handling\"\"\"\n        try:\n            with open(filename, \"r\", encoding=\"utf-8\") as file:\n                content = file.read()\n                print(f\"✅ Successfully read {filename}\")\n                return content\n        \n        except FileNotFoundError:\n            print(f\"❌ File not found: {filename}\")\n            return None\n        \n        except PermissionError:\n            print(f\"❌ Permission denied: {filename}\")\n            return None\n        \n        except UnicodeDecodeError:\n            print(f\"❌ Encoding error: {filename}\")\n            return None\n        \n        except Exception as e:\n            print(f\"❌ Unexpected error: {e}\")\n            return None\n    \n    def safe_file_write(filename, content):\n        \"\"\"Safely write file with error handling\"\"\"\n        try:\n            with open(filename, \"w\", encoding=\"utf-8\") as file:\n                file.write(content)\n                print(f\"✅ Successfully wrote {filename}\")\n                return True\n        \n        except PermissionError:\n            print(f\"❌ Permission denied writing: {filename}\")\n            return False\n        \n        except OSError as e:\n            print(f\"❌ System error: {e}\")\n            return False\n        \n        except Exception as e:\n            print(f\"❌ Unexpected error: {e}\")\n            return False\n    \n    # Test error handling\n    print(\"Testing file error handling:\")\n    \n    # Test reading existing file\n    safe_file_write(\"test_file.txt\", \"This is test content\")\n    safe_file_read(\"test_file.txt\")\n    \n    # Test reading non-existent file\n    safe_file_read(\"missing_file.txt\")\n    \n    # Test writing to invalid location (may work on some systems)\n    safe_file_write(\"/invalid/path/file.txt\", \"content\")\n    \n    # File existence checking\n    def check_file_safely(filename):\n        \"\"\"Check file properties safely\"\"\"\n        if os.path.exists(filename):\n            try:\n                size = os.path.getsize(filename)\n                print(f\"📄 {filename}: {size} bytes\")\n                \n                # Check if readable/writable\n                readable = os.access(filename, os.R_OK)\n                writable = os.access(filename, os.W_OK)\n                print(f\"   Readable: {readable}, Writable: {writable}\")\n                \n            except OSError as e:\n                print(f\"❌ Error checking {filename}: {e}\")\n        else:\n            print(f\"❓ {filename} does not exist\")\n    \n    print(\"\\nFile property checking:\")\n    check_file_safely(\"test_file.txt\")\n    check_file_safely(\"missing_file.txt\")\n\nfile_error_handling_examples()\n",[4789],{"type":993,"tag":1022,"props":4790,"children":4791},{"__ignoreMap":8},[4792,4805,4812,4828,4836,4843,4861,4869,4880,4931,4950,4991,5004,5011,5026,5066,5079,5086,5101,5141,5152,5159,5174,5214,5225,5232,5254,5295,5306,5313,5330,5338,5349,5400,5412,5452,5464,5471,5486,5526,5538,5545,5565,5605,5616,5623,5642,5681,5692,5699,5707,5727,5734,5742,5768,5784,5791,5799,5815,5822,5830,5855,5862,5870,5886,5894,5907,5919,5936,5994,6002,6010,6036,6061,6120,6127,6147,6203,6215,6256,6263,6291,6307,6322,6330],{"type":993,"tag":1026,"props":4793,"children":4794},{"class":1028,"line":12},[4795,4800],{"type":993,"tag":1026,"props":4796,"children":4797},{"style":1055},[4798],{"type":998,"value":4799},"import",{"type":993,"tag":1026,"props":4801,"children":4802},{"style":1067},[4803],{"type":998,"value":4804}," os\n",{"type":993,"tag":1026,"props":4806,"children":4807},{"class":1028,"line":27},[4808],{"type":993,"tag":1026,"props":4809,"children":4810},{"emptyLinePlaceholder":13},[4811],{"type":998,"value":1137},{"type":993,"tag":1026,"props":4813,"children":4814},{"class":1028,"line":36},[4815,4819,4824],{"type":993,"tag":1026,"props":4816,"children":4817},{"style":1055},[4818],{"type":998,"value":2161},{"type":993,"tag":1026,"props":4820,"children":4821},{"style":2164},[4822],{"type":998,"value":4823}," file_error_handling_examples",{"type":993,"tag":1026,"props":4825,"children":4826},{"style":1067},[4827],{"type":998,"value":2172},{"type":993,"tag":1026,"props":4829,"children":4830},{"class":1028,"line":45},[4831],{"type":993,"tag":1026,"props":4832,"children":4833},{"style":1073},[4834],{"type":998,"value":4835},"    \"\"\"Demonstrate comprehensive file error handling\"\"\"\n",{"type":993,"tag":1026,"props":4837,"children":4838},{"class":1028,"line":54},[4839],{"type":993,"tag":1026,"props":4840,"children":4841},{"style":1067},[4842],{"type":998,"value":2188},{"type":993,"tag":1026,"props":4844,"children":4845},{"class":1028,"line":63},[4846,4851,4856],{"type":993,"tag":1026,"props":4847,"children":4848},{"style":1055},[4849],{"type":998,"value":4850},"    def",{"type":993,"tag":1026,"props":4852,"children":4853},{"style":2164},[4854],{"type":998,"value":4855}," safe_file_read",{"type":993,"tag":1026,"props":4857,"children":4858},{"style":1067},[4859],{"type":998,"value":4860},"(filename):\n",{"type":993,"tag":1026,"props":4862,"children":4863},{"class":1028,"line":72},[4864],{"type":993,"tag":1026,"props":4865,"children":4866},{"style":1073},[4867],{"type":998,"value":4868},"        \"\"\"Safely read file with comprehensive error handling\"\"\"\n",{"type":993,"tag":1026,"props":4870,"children":4871},{"class":1028,"line":81},[4872,4876],{"type":993,"tag":1026,"props":4873,"children":4874},{"style":1055},[4875],{"type":998,"value":4388},{"type":993,"tag":1026,"props":4877,"children":4878},{"style":1067},[4879],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4881,"children":4882},{"class":1028,"line":91},[4883,4887,4891,4895,4899,4903,4907,4911,4915,4919,4923,4927],{"type":993,"tag":1026,"props":4884,"children":4885},{"style":1055},[4886],{"type":998,"value":4439},{"type":993,"tag":1026,"props":4888,"children":4889},{"style":1061},[4890],{"type":998,"value":1064},{"type":993,"tag":1026,"props":4892,"children":4893},{"style":1067},[4894],{"type":998,"value":1591},{"type":993,"tag":1026,"props":4896,"children":4897},{"style":1073},[4898],{"type":998,"value":1177},{"type":993,"tag":1026,"props":4900,"children":4901},{"style":1067},[4902],{"type":998,"value":1081},{"type":993,"tag":1026,"props":4904,"children":4905},{"style":1049},[4906],{"type":998,"value":3737},{"type":993,"tag":1026,"props":4908,"children":4909},{"style":1055},[4910],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4912,"children":4913},{"style":1073},[4914],{"type":998,"value":3746},{"type":993,"tag":1026,"props":4916,"children":4917},{"style":1067},[4918],{"type":998,"value":1310},{"type":993,"tag":1026,"props":4920,"children":4921},{"style":1055},[4922],{"type":998,"value":1315},{"type":993,"tag":1026,"props":4924,"children":4925},{"style":1049},[4926],{"type":998,"value":1199},{"type":993,"tag":1026,"props":4928,"children":4929},{"style":1067},[4930],{"type":998,"value":1324},{"type":993,"tag":1026,"props":4932,"children":4933},{"class":1028,"line":100},[4934,4938,4942,4946],{"type":993,"tag":1026,"props":4935,"children":4936},{"style":1067},[4937],{"type":998,"value":4564},{"type":993,"tag":1026,"props":4939,"children":4940},{"style":1055},[4941],{"type":998,"value":1194},{"type":993,"tag":1026,"props":4943,"children":4944},{"style":1049},[4945],{"type":998,"value":1199},{"type":993,"tag":1026,"props":4947,"children":4948},{"style":1067},[4949],{"type":998,"value":1204},{"type":993,"tag":1026,"props":4951,"children":4952},{"class":1028,"line":109},[4953,4957,4961,4965,4970,4974,4979,4983,4987],{"type":993,"tag":1026,"props":4954,"children":4955},{"style":1061},[4956],{"type":998,"value":4584},{"type":993,"tag":1026,"props":4958,"children":4959},{"style":1067},[4960],{"type":998,"value":1070},{"type":993,"tag":1026,"props":4962,"children":4963},{"style":1055},[4964],{"type":998,"value":1221},{"type":993,"tag":1026,"props":4966,"children":4967},{"style":1073},[4968],{"type":998,"value":4969},"\"✅ Successfully read ",{"type":993,"tag":1026,"props":4971,"children":4972},{"style":1061},[4973],{"type":998,"value":1231},{"type":993,"tag":1026,"props":4975,"children":4976},{"style":1067},[4977],{"type":998,"value":4978},"filename",{"type":993,"tag":1026,"props":4980,"children":4981},{"style":1061},[4982],{"type":998,"value":1240},{"type":993,"tag":1026,"props":4984,"children":4985},{"style":1073},[4986],{"type":998,"value":1245},{"type":993,"tag":1026,"props":4988,"children":4989},{"style":1067},[4990],{"type":998,"value":1091},{"type":993,"tag":1026,"props":4992,"children":4993},{"class":1028,"line":118},[4994,4999],{"type":993,"tag":1026,"props":4995,"children":4996},{"style":1055},[4997],{"type":998,"value":4998},"                return",{"type":993,"tag":1026,"props":5000,"children":5001},{"style":1067},[5002],{"type":998,"value":5003}," content\n",{"type":993,"tag":1026,"props":5005,"children":5006},{"class":1028,"line":127},[5007],{"type":993,"tag":1026,"props":5008,"children":5009},{"style":1067},[5010],{"type":998,"value":4641},{"type":993,"tag":1026,"props":5012,"children":5013},{"class":1028,"line":136},[5014,5018,5022],{"type":993,"tag":1026,"props":5015,"children":5016},{"style":1055},[5017],{"type":998,"value":4649},{"type":993,"tag":1026,"props":5019,"children":5020},{"style":1061},[5021],{"type":998,"value":2668},{"type":993,"tag":1026,"props":5023,"children":5024},{"style":1067},[5025],{"type":998,"value":1324},{"type":993,"tag":1026,"props":5027,"children":5028},{"class":1028,"line":146},[5029,5033,5037,5041,5046,5050,5054,5058,5062],{"type":993,"tag":1026,"props":5030,"children":5031},{"style":1061},[5032],{"type":998,"value":4666},{"type":993,"tag":1026,"props":5034,"children":5035},{"style":1067},[5036],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5038,"children":5039},{"style":1055},[5040],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5042,"children":5043},{"style":1073},[5044],{"type":998,"value":5045},"\"❌ File not found: ",{"type":993,"tag":1026,"props":5047,"children":5048},{"style":1061},[5049],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5051,"children":5052},{"style":1067},[5053],{"type":998,"value":4978},{"type":993,"tag":1026,"props":5055,"children":5056},{"style":1061},[5057],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5059,"children":5060},{"style":1073},[5061],{"type":998,"value":1245},{"type":993,"tag":1026,"props":5063,"children":5064},{"style":1067},[5065],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5067,"children":5068},{"class":1028,"line":155},[5069,5074],{"type":993,"tag":1026,"props":5070,"children":5071},{"style":1055},[5072],{"type":998,"value":5073},"            return",{"type":993,"tag":1026,"props":5075,"children":5076},{"style":1061},[5077],{"type":998,"value":5078}," None\n",{"type":993,"tag":1026,"props":5080,"children":5081},{"class":1028,"line":164},[5082],{"type":993,"tag":1026,"props":5083,"children":5084},{"style":1067},[5085],{"type":998,"value":4641},{"type":993,"tag":1026,"props":5087,"children":5088},{"class":1028,"line":173},[5089,5093,5097],{"type":993,"tag":1026,"props":5090,"children":5091},{"style":1055},[5092],{"type":998,"value":4649},{"type":993,"tag":1026,"props":5094,"children":5095},{"style":1061},[5096],{"type":998,"value":2704},{"type":993,"tag":1026,"props":5098,"children":5099},{"style":1067},[5100],{"type":998,"value":1324},{"type":993,"tag":1026,"props":5102,"children":5103},{"class":1028,"line":182},[5104,5108,5112,5116,5121,5125,5129,5133,5137],{"type":993,"tag":1026,"props":5105,"children":5106},{"style":1061},[5107],{"type":998,"value":4666},{"type":993,"tag":1026,"props":5109,"children":5110},{"style":1067},[5111],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5113,"children":5114},{"style":1055},[5115],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5117,"children":5118},{"style":1073},[5119],{"type":998,"value":5120},"\"❌ Permission denied: ",{"type":993,"tag":1026,"props":5122,"children":5123},{"style":1061},[5124],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5126,"children":5127},{"style":1067},[5128],{"type":998,"value":4978},{"type":993,"tag":1026,"props":5130,"children":5131},{"style":1061},[5132],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5134,"children":5135},{"style":1073},[5136],{"type":998,"value":1245},{"type":993,"tag":1026,"props":5138,"children":5139},{"style":1067},[5140],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5142,"children":5143},{"class":1028,"line":191},[5144,5148],{"type":993,"tag":1026,"props":5145,"children":5146},{"style":1055},[5147],{"type":998,"value":5073},{"type":993,"tag":1026,"props":5149,"children":5150},{"style":1061},[5151],{"type":998,"value":5078},{"type":993,"tag":1026,"props":5153,"children":5154},{"class":1028,"line":201},[5155],{"type":993,"tag":1026,"props":5156,"children":5157},{"style":1067},[5158],{"type":998,"value":4641},{"type":993,"tag":1026,"props":5160,"children":5161},{"class":1028,"line":210},[5162,5166,5170],{"type":993,"tag":1026,"props":5163,"children":5164},{"style":1055},[5165],{"type":998,"value":4649},{"type":993,"tag":1026,"props":5167,"children":5168},{"style":1061},[5169],{"type":998,"value":4711},{"type":993,"tag":1026,"props":5171,"children":5172},{"style":1067},[5173],{"type":998,"value":1324},{"type":993,"tag":1026,"props":5175,"children":5176},{"class":1028,"line":219},[5177,5181,5185,5189,5194,5198,5202,5206,5210],{"type":993,"tag":1026,"props":5178,"children":5179},{"style":1061},[5180],{"type":998,"value":4666},{"type":993,"tag":1026,"props":5182,"children":5183},{"style":1067},[5184],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5186,"children":5187},{"style":1055},[5188],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5190,"children":5191},{"style":1073},[5192],{"type":998,"value":5193},"\"❌ Encoding error: ",{"type":993,"tag":1026,"props":5195,"children":5196},{"style":1061},[5197],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5199,"children":5200},{"style":1067},[5201],{"type":998,"value":4978},{"type":993,"tag":1026,"props":5203,"children":5204},{"style":1061},[5205],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5207,"children":5208},{"style":1073},[5209],{"type":998,"value":1245},{"type":993,"tag":1026,"props":5211,"children":5212},{"style":1067},[5213],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5215,"children":5216},{"class":1028,"line":228},[5217,5221],{"type":993,"tag":1026,"props":5218,"children":5219},{"style":1055},[5220],{"type":998,"value":5073},{"type":993,"tag":1026,"props":5222,"children":5223},{"style":1061},[5224],{"type":998,"value":5078},{"type":993,"tag":1026,"props":5226,"children":5227},{"class":1028,"line":238},[5228],{"type":993,"tag":1026,"props":5229,"children":5230},{"style":1067},[5231],{"type":998,"value":4641},{"type":993,"tag":1026,"props":5233,"children":5234},{"class":1028,"line":247},[5235,5239,5244,5249],{"type":993,"tag":1026,"props":5236,"children":5237},{"style":1055},[5238],{"type":998,"value":4649},{"type":993,"tag":1026,"props":5240,"children":5241},{"style":1061},[5242],{"type":998,"value":5243}," Exception",{"type":993,"tag":1026,"props":5245,"children":5246},{"style":1055},[5247],{"type":998,"value":5248}," as",{"type":993,"tag":1026,"props":5250,"children":5251},{"style":1067},[5252],{"type":998,"value":5253}," e:\n",{"type":993,"tag":1026,"props":5255,"children":5256},{"class":1028,"line":256},[5257,5261,5265,5269,5274,5278,5283,5287,5291],{"type":993,"tag":1026,"props":5258,"children":5259},{"style":1061},[5260],{"type":998,"value":4666},{"type":993,"tag":1026,"props":5262,"children":5263},{"style":1067},[5264],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5266,"children":5267},{"style":1055},[5268],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5270,"children":5271},{"style":1073},[5272],{"type":998,"value":5273},"\"❌ Unexpected error: ",{"type":993,"tag":1026,"props":5275,"children":5276},{"style":1061},[5277],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5279,"children":5280},{"style":1067},[5281],{"type":998,"value":5282},"e",{"type":993,"tag":1026,"props":5284,"children":5285},{"style":1061},[5286],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5288,"children":5289},{"style":1073},[5290],{"type":998,"value":1245},{"type":993,"tag":1026,"props":5292,"children":5293},{"style":1067},[5294],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5296,"children":5297},{"class":1028,"line":265},[5298,5302],{"type":993,"tag":1026,"props":5299,"children":5300},{"style":1055},[5301],{"type":998,"value":5073},{"type":993,"tag":1026,"props":5303,"children":5304},{"style":1061},[5305],{"type":998,"value":5078},{"type":993,"tag":1026,"props":5307,"children":5308},{"class":1028,"line":274},[5309],{"type":993,"tag":1026,"props":5310,"children":5311},{"style":1067},[5312],{"type":998,"value":2188},{"type":993,"tag":1026,"props":5314,"children":5315},{"class":1028,"line":284},[5316,5320,5325],{"type":993,"tag":1026,"props":5317,"children":5318},{"style":1055},[5319],{"type":998,"value":4850},{"type":993,"tag":1026,"props":5321,"children":5322},{"style":2164},[5323],{"type":998,"value":5324}," safe_file_write",{"type":993,"tag":1026,"props":5326,"children":5327},{"style":1067},[5328],{"type":998,"value":5329},"(filename, content):\n",{"type":993,"tag":1026,"props":5331,"children":5332},{"class":1028,"line":293},[5333],{"type":993,"tag":1026,"props":5334,"children":5335},{"style":1073},[5336],{"type":998,"value":5337},"        \"\"\"Safely write file with error handling\"\"\"\n",{"type":993,"tag":1026,"props":5339,"children":5340},{"class":1028,"line":302},[5341,5345],{"type":993,"tag":1026,"props":5342,"children":5343},{"style":1055},[5344],{"type":998,"value":4388},{"type":993,"tag":1026,"props":5346,"children":5347},{"style":1067},[5348],{"type":998,"value":1324},{"type":993,"tag":1026,"props":5350,"children":5351},{"class":1028,"line":311},[5352,5356,5360,5364,5368,5372,5376,5380,5384,5388,5392,5396],{"type":993,"tag":1026,"props":5353,"children":5354},{"style":1055},[5355],{"type":998,"value":4439},{"type":993,"tag":1026,"props":5357,"children":5358},{"style":1061},[5359],{"type":998,"value":1064},{"type":993,"tag":1026,"props":5361,"children":5362},{"style":1067},[5363],{"type":998,"value":1591},{"type":993,"tag":1026,"props":5365,"children":5366},{"style":1073},[5367],{"type":998,"value":1086},{"type":993,"tag":1026,"props":5369,"children":5370},{"style":1067},[5371],{"type":998,"value":1081},{"type":993,"tag":1026,"props":5373,"children":5374},{"style":1049},[5375],{"type":998,"value":3737},{"type":993,"tag":1026,"props":5377,"children":5378},{"style":1055},[5379],{"type":998,"value":1194},{"type":993,"tag":1026,"props":5381,"children":5382},{"style":1073},[5383],{"type":998,"value":3746},{"type":993,"tag":1026,"props":5385,"children":5386},{"style":1067},[5387],{"type":998,"value":1310},{"type":993,"tag":1026,"props":5389,"children":5390},{"style":1055},[5391],{"type":998,"value":1315},{"type":993,"tag":1026,"props":5393,"children":5394},{"style":1049},[5395],{"type":998,"value":1199},{"type":993,"tag":1026,"props":5397,"children":5398},{"style":1067},[5399],{"type":998,"value":1324},{"type":993,"tag":1026,"props":5401,"children":5402},{"class":1028,"line":320},[5403,5407],{"type":993,"tag":1026,"props":5404,"children":5405},{"style":1049},[5406],{"type":998,"value":4488},{"type":993,"tag":1026,"props":5408,"children":5409},{"style":1067},[5410],{"type":998,"value":5411},".write(content)\n",{"type":993,"tag":1026,"props":5413,"children":5414},{"class":1028,"line":329},[5415,5419,5423,5427,5432,5436,5440,5444,5448],{"type":993,"tag":1026,"props":5416,"children":5417},{"style":1061},[5418],{"type":998,"value":4584},{"type":993,"tag":1026,"props":5420,"children":5421},{"style":1067},[5422],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5424,"children":5425},{"style":1055},[5426],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5428,"children":5429},{"style":1073},[5430],{"type":998,"value":5431},"\"✅ Successfully wrote ",{"type":993,"tag":1026,"props":5433,"children":5434},{"style":1061},[5435],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5437,"children":5438},{"style":1067},[5439],{"type":998,"value":4978},{"type":993,"tag":1026,"props":5441,"children":5442},{"style":1061},[5443],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5445,"children":5446},{"style":1073},[5447],{"type":998,"value":1245},{"type":993,"tag":1026,"props":5449,"children":5450},{"style":1067},[5451],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5453,"children":5454},{"class":1028,"line":338},[5455,5459],{"type":993,"tag":1026,"props":5456,"children":5457},{"style":1055},[5458],{"type":998,"value":4998},{"type":993,"tag":1026,"props":5460,"children":5461},{"style":1061},[5462],{"type":998,"value":5463}," True\n",{"type":993,"tag":1026,"props":5465,"children":5466},{"class":1028,"line":347},[5467],{"type":993,"tag":1026,"props":5468,"children":5469},{"style":1067},[5470],{"type":998,"value":4641},{"type":993,"tag":1026,"props":5472,"children":5473},{"class":1028,"line":356},[5474,5478,5482],{"type":993,"tag":1026,"props":5475,"children":5476},{"style":1055},[5477],{"type":998,"value":4649},{"type":993,"tag":1026,"props":5479,"children":5480},{"style":1061},[5481],{"type":998,"value":2704},{"type":993,"tag":1026,"props":5483,"children":5484},{"style":1067},[5485],{"type":998,"value":1324},{"type":993,"tag":1026,"props":5487,"children":5488},{"class":1028,"line":365},[5489,5493,5497,5501,5506,5510,5514,5518,5522],{"type":993,"tag":1026,"props":5490,"children":5491},{"style":1061},[5492],{"type":998,"value":4666},{"type":993,"tag":1026,"props":5494,"children":5495},{"style":1067},[5496],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5498,"children":5499},{"style":1055},[5500],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5502,"children":5503},{"style":1073},[5504],{"type":998,"value":5505},"\"❌ Permission denied writing: ",{"type":993,"tag":1026,"props":5507,"children":5508},{"style":1061},[5509],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5511,"children":5512},{"style":1067},[5513],{"type":998,"value":4978},{"type":993,"tag":1026,"props":5515,"children":5516},{"style":1061},[5517],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5519,"children":5520},{"style":1073},[5521],{"type":998,"value":1245},{"type":993,"tag":1026,"props":5523,"children":5524},{"style":1067},[5525],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5527,"children":5528},{"class":1028,"line":374},[5529,5533],{"type":993,"tag":1026,"props":5530,"children":5531},{"style":1055},[5532],{"type":998,"value":5073},{"type":993,"tag":1026,"props":5534,"children":5535},{"style":1061},[5536],{"type":998,"value":5537}," False\n",{"type":993,"tag":1026,"props":5539,"children":5540},{"class":1028,"line":384},[5541],{"type":993,"tag":1026,"props":5542,"children":5543},{"style":1067},[5544],{"type":998,"value":4641},{"type":993,"tag":1026,"props":5546,"children":5547},{"class":1028,"line":393},[5548,5552,5557,5561],{"type":993,"tag":1026,"props":5549,"children":5550},{"style":1055},[5551],{"type":998,"value":4649},{"type":993,"tag":1026,"props":5553,"children":5554},{"style":1061},[5555],{"type":998,"value":5556}," OSError",{"type":993,"tag":1026,"props":5558,"children":5559},{"style":1055},[5560],{"type":998,"value":5248},{"type":993,"tag":1026,"props":5562,"children":5563},{"style":1067},[5564],{"type":998,"value":5253},{"type":993,"tag":1026,"props":5566,"children":5567},{"class":1028,"line":402},[5568,5572,5576,5580,5585,5589,5593,5597,5601],{"type":993,"tag":1026,"props":5569,"children":5570},{"style":1061},[5571],{"type":998,"value":4666},{"type":993,"tag":1026,"props":5573,"children":5574},{"style":1067},[5575],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5577,"children":5578},{"style":1055},[5579],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5581,"children":5582},{"style":1073},[5583],{"type":998,"value":5584},"\"❌ System error: ",{"type":993,"tag":1026,"props":5586,"children":5587},{"style":1061},[5588],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5590,"children":5591},{"style":1067},[5592],{"type":998,"value":5282},{"type":993,"tag":1026,"props":5594,"children":5595},{"style":1061},[5596],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5598,"children":5599},{"style":1073},[5600],{"type":998,"value":1245},{"type":993,"tag":1026,"props":5602,"children":5603},{"style":1067},[5604],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5606,"children":5607},{"class":1028,"line":411},[5608,5612],{"type":993,"tag":1026,"props":5609,"children":5610},{"style":1055},[5611],{"type":998,"value":5073},{"type":993,"tag":1026,"props":5613,"children":5614},{"style":1061},[5615],{"type":998,"value":5537},{"type":993,"tag":1026,"props":5617,"children":5618},{"class":1028,"line":420},[5619],{"type":993,"tag":1026,"props":5620,"children":5621},{"style":1067},[5622],{"type":998,"value":4641},{"type":993,"tag":1026,"props":5624,"children":5625},{"class":1028,"line":429},[5626,5630,5634,5638],{"type":993,"tag":1026,"props":5627,"children":5628},{"style":1055},[5629],{"type":998,"value":4649},{"type":993,"tag":1026,"props":5631,"children":5632},{"style":1061},[5633],{"type":998,"value":5243},{"type":993,"tag":1026,"props":5635,"children":5636},{"style":1055},[5637],{"type":998,"value":5248},{"type":993,"tag":1026,"props":5639,"children":5640},{"style":1067},[5641],{"type":998,"value":5253},{"type":993,"tag":1026,"props":5643,"children":5644},{"class":1028,"line":438},[5645,5649,5653,5657,5661,5665,5669,5673,5677],{"type":993,"tag":1026,"props":5646,"children":5647},{"style":1061},[5648],{"type":998,"value":4666},{"type":993,"tag":1026,"props":5650,"children":5651},{"style":1067},[5652],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5654,"children":5655},{"style":1055},[5656],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5658,"children":5659},{"style":1073},[5660],{"type":998,"value":5273},{"type":993,"tag":1026,"props":5662,"children":5663},{"style":1061},[5664],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5666,"children":5667},{"style":1067},[5668],{"type":998,"value":5282},{"type":993,"tag":1026,"props":5670,"children":5671},{"style":1061},[5672],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5674,"children":5675},{"style":1073},[5676],{"type":998,"value":1245},{"type":993,"tag":1026,"props":5678,"children":5679},{"style":1067},[5680],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5682,"children":5683},{"class":1028,"line":447},[5684,5688],{"type":993,"tag":1026,"props":5685,"children":5686},{"style":1055},[5687],{"type":998,"value":5073},{"type":993,"tag":1026,"props":5689,"children":5690},{"style":1061},[5691],{"type":998,"value":5537},{"type":993,"tag":1026,"props":5693,"children":5694},{"class":1028,"line":457},[5695],{"type":993,"tag":1026,"props":5696,"children":5697},{"style":1067},[5698],{"type":998,"value":2188},{"type":993,"tag":1026,"props":5700,"children":5701},{"class":1028,"line":466},[5702],{"type":993,"tag":1026,"props":5703,"children":5704},{"style":1032},[5705],{"type":998,"value":5706},"    # Test error handling\n",{"type":993,"tag":1026,"props":5708,"children":5709},{"class":1028,"line":475},[5710,5714,5718,5723],{"type":993,"tag":1026,"props":5711,"children":5712},{"style":1061},[5713],{"type":998,"value":1495},{"type":993,"tag":1026,"props":5715,"children":5716},{"style":1067},[5717],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5719,"children":5720},{"style":1073},[5721],{"type":998,"value":5722},"\"Testing file error handling:\"",{"type":993,"tag":1026,"props":5724,"children":5725},{"style":1067},[5726],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5728,"children":5729},{"class":1028,"line":484},[5730],{"type":993,"tag":1026,"props":5731,"children":5732},{"style":1067},[5733],{"type":998,"value":2188},{"type":993,"tag":1026,"props":5735,"children":5736},{"class":1028,"line":493},[5737],{"type":993,"tag":1026,"props":5738,"children":5739},{"style":1032},[5740],{"type":998,"value":5741},"    # Test reading existing file\n",{"type":993,"tag":1026,"props":5743,"children":5744},{"class":1028,"line":502},[5745,5750,5755,5759,5764],{"type":993,"tag":1026,"props":5746,"children":5747},{"style":1067},[5748],{"type":998,"value":5749},"    safe_file_write(",{"type":993,"tag":1026,"props":5751,"children":5752},{"style":1073},[5753],{"type":998,"value":5754},"\"test_file.txt\"",{"type":993,"tag":1026,"props":5756,"children":5757},{"style":1067},[5758],{"type":998,"value":1081},{"type":993,"tag":1026,"props":5760,"children":5761},{"style":1073},[5762],{"type":998,"value":5763},"\"This is test content\"",{"type":993,"tag":1026,"props":5765,"children":5766},{"style":1067},[5767],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5769,"children":5770},{"class":1028,"line":511},[5771,5776,5780],{"type":993,"tag":1026,"props":5772,"children":5773},{"style":1067},[5774],{"type":998,"value":5775},"    safe_file_read(",{"type":993,"tag":1026,"props":5777,"children":5778},{"style":1073},[5779],{"type":998,"value":5754},{"type":993,"tag":1026,"props":5781,"children":5782},{"style":1067},[5783],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5785,"children":5786},{"class":1028,"line":520},[5787],{"type":993,"tag":1026,"props":5788,"children":5789},{"style":1067},[5790],{"type":998,"value":2188},{"type":993,"tag":1026,"props":5792,"children":5793},{"class":1028,"line":530},[5794],{"type":993,"tag":1026,"props":5795,"children":5796},{"style":1032},[5797],{"type":998,"value":5798},"    # Test reading non-existent file\n",{"type":993,"tag":1026,"props":5800,"children":5801},{"class":1028,"line":539},[5802,5806,5811],{"type":993,"tag":1026,"props":5803,"children":5804},{"style":1067},[5805],{"type":998,"value":5775},{"type":993,"tag":1026,"props":5807,"children":5808},{"style":1073},[5809],{"type":998,"value":5810},"\"missing_file.txt\"",{"type":993,"tag":1026,"props":5812,"children":5813},{"style":1067},[5814],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5816,"children":5817},{"class":1028,"line":548},[5818],{"type":993,"tag":1026,"props":5819,"children":5820},{"style":1067},[5821],{"type":998,"value":2188},{"type":993,"tag":1026,"props":5823,"children":5824},{"class":1028,"line":557},[5825],{"type":993,"tag":1026,"props":5826,"children":5827},{"style":1032},[5828],{"type":998,"value":5829},"    # Test writing to invalid location (may work on some systems)\n",{"type":993,"tag":1026,"props":5831,"children":5832},{"class":1028,"line":566},[5833,5837,5842,5846,5851],{"type":993,"tag":1026,"props":5834,"children":5835},{"style":1067},[5836],{"type":998,"value":5749},{"type":993,"tag":1026,"props":5838,"children":5839},{"style":1073},[5840],{"type":998,"value":5841},"\"/invalid/path/file.txt\"",{"type":993,"tag":1026,"props":5843,"children":5844},{"style":1067},[5845],{"type":998,"value":1081},{"type":993,"tag":1026,"props":5847,"children":5848},{"style":1073},[5849],{"type":998,"value":5850},"\"content\"",{"type":993,"tag":1026,"props":5852,"children":5853},{"style":1067},[5854],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5856,"children":5857},{"class":1028,"line":575},[5858],{"type":993,"tag":1026,"props":5859,"children":5860},{"style":1067},[5861],{"type":998,"value":2188},{"type":993,"tag":1026,"props":5863,"children":5864},{"class":1028,"line":584},[5865],{"type":993,"tag":1026,"props":5866,"children":5867},{"style":1032},[5868],{"type":998,"value":5869},"    # File existence checking\n",{"type":993,"tag":1026,"props":5871,"children":5872},{"class":1028,"line":593},[5873,5877,5882],{"type":993,"tag":1026,"props":5874,"children":5875},{"style":1055},[5876],{"type":998,"value":4850},{"type":993,"tag":1026,"props":5878,"children":5879},{"style":2164},[5880],{"type":998,"value":5881}," check_file_safely",{"type":993,"tag":1026,"props":5883,"children":5884},{"style":1067},[5885],{"type":998,"value":4860},{"type":993,"tag":1026,"props":5887,"children":5888},{"class":1028,"line":602},[5889],{"type":993,"tag":1026,"props":5890,"children":5891},{"style":1073},[5892],{"type":998,"value":5893},"        \"\"\"Check file properties safely\"\"\"\n",{"type":993,"tag":1026,"props":5895,"children":5896},{"class":1028,"line":611},[5897,5902],{"type":993,"tag":1026,"props":5898,"children":5899},{"style":1055},[5900],{"type":998,"value":5901},"        if",{"type":993,"tag":1026,"props":5903,"children":5904},{"style":1067},[5905],{"type":998,"value":5906}," os.path.exists(filename):\n",{"type":993,"tag":1026,"props":5908,"children":5909},{"class":1028,"line":621},[5910,5915],{"type":993,"tag":1026,"props":5911,"children":5912},{"style":1055},[5913],{"type":998,"value":5914},"            try",{"type":993,"tag":1026,"props":5916,"children":5917},{"style":1067},[5918],{"type":998,"value":1324},{"type":993,"tag":1026,"props":5920,"children":5921},{"class":1028,"line":630},[5922,5927,5931],{"type":993,"tag":1026,"props":5923,"children":5924},{"style":1067},[5925],{"type":998,"value":5926},"                size ",{"type":993,"tag":1026,"props":5928,"children":5929},{"style":1055},[5930],{"type":998,"value":1194},{"type":993,"tag":1026,"props":5932,"children":5933},{"style":1067},[5934],{"type":998,"value":5935}," os.path.getsize(filename)\n",{"type":993,"tag":1026,"props":5937,"children":5938},{"class":1028,"line":639},[5939,5943,5947,5951,5956,5960,5964,5968,5972,5976,5981,5985,5990],{"type":993,"tag":1026,"props":5940,"children":5941},{"style":1061},[5942],{"type":998,"value":4584},{"type":993,"tag":1026,"props":5944,"children":5945},{"style":1067},[5946],{"type":998,"value":1070},{"type":993,"tag":1026,"props":5948,"children":5949},{"style":1055},[5950],{"type":998,"value":1221},{"type":993,"tag":1026,"props":5952,"children":5953},{"style":1073},[5954],{"type":998,"value":5955},"\"📄 ",{"type":993,"tag":1026,"props":5957,"children":5958},{"style":1061},[5959],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5961,"children":5962},{"style":1067},[5963],{"type":998,"value":4978},{"type":993,"tag":1026,"props":5965,"children":5966},{"style":1061},[5967],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5969,"children":5970},{"style":1073},[5971],{"type":998,"value":4613},{"type":993,"tag":1026,"props":5973,"children":5974},{"style":1061},[5975],{"type":998,"value":1231},{"type":993,"tag":1026,"props":5977,"children":5978},{"style":1067},[5979],{"type":998,"value":5980},"size",{"type":993,"tag":1026,"props":5982,"children":5983},{"style":1061},[5984],{"type":998,"value":1240},{"type":993,"tag":1026,"props":5986,"children":5987},{"style":1073},[5988],{"type":998,"value":5989}," bytes\"",{"type":993,"tag":1026,"props":5991,"children":5992},{"style":1067},[5993],{"type":998,"value":1091},{"type":993,"tag":1026,"props":5995,"children":5996},{"class":1028,"line":648},[5997],{"type":993,"tag":1026,"props":5998,"children":5999},{"style":1067},[6000],{"type":998,"value":6001},"                \n",{"type":993,"tag":1026,"props":6003,"children":6004},{"class":1028,"line":657},[6005],{"type":993,"tag":1026,"props":6006,"children":6007},{"style":1032},[6008],{"type":998,"value":6009},"                # Check if readable/writable\n",{"type":993,"tag":1026,"props":6011,"children":6012},{"class":1028,"line":666},[6013,6018,6022,6027,6032],{"type":993,"tag":1026,"props":6014,"children":6015},{"style":1067},[6016],{"type":998,"value":6017},"                readable ",{"type":993,"tag":1026,"props":6019,"children":6020},{"style":1055},[6021],{"type":998,"value":1194},{"type":993,"tag":1026,"props":6023,"children":6024},{"style":1067},[6025],{"type":998,"value":6026}," os.access(filename, os.",{"type":993,"tag":1026,"props":6028,"children":6029},{"style":1061},[6030],{"type":998,"value":6031},"R_OK",{"type":993,"tag":1026,"props":6033,"children":6034},{"style":1067},[6035],{"type":998,"value":1091},{"type":993,"tag":1026,"props":6037,"children":6038},{"class":1028,"line":675},[6039,6044,6048,6052,6057],{"type":993,"tag":1026,"props":6040,"children":6041},{"style":1067},[6042],{"type":998,"value":6043},"                writable ",{"type":993,"tag":1026,"props":6045,"children":6046},{"style":1055},[6047],{"type":998,"value":1194},{"type":993,"tag":1026,"props":6049,"children":6050},{"style":1067},[6051],{"type":998,"value":6026},{"type":993,"tag":1026,"props":6053,"children":6054},{"style":1061},[6055],{"type":998,"value":6056},"W_OK",{"type":993,"tag":1026,"props":6058,"children":6059},{"style":1067},[6060],{"type":998,"value":1091},{"type":993,"tag":1026,"props":6062,"children":6063},{"class":1028,"line":685},[6064,6068,6072,6076,6081,6085,6090,6094,6099,6103,6108,6112,6116],{"type":993,"tag":1026,"props":6065,"children":6066},{"style":1061},[6067],{"type":998,"value":4584},{"type":993,"tag":1026,"props":6069,"children":6070},{"style":1067},[6071],{"type":998,"value":1070},{"type":993,"tag":1026,"props":6073,"children":6074},{"style":1055},[6075],{"type":998,"value":1221},{"type":993,"tag":1026,"props":6077,"children":6078},{"style":1073},[6079],{"type":998,"value":6080},"\"   Readable: ",{"type":993,"tag":1026,"props":6082,"children":6083},{"style":1061},[6084],{"type":998,"value":1231},{"type":993,"tag":1026,"props":6086,"children":6087},{"style":1067},[6088],{"type":998,"value":6089},"readable",{"type":993,"tag":1026,"props":6091,"children":6092},{"style":1061},[6093],{"type":998,"value":1240},{"type":993,"tag":1026,"props":6095,"children":6096},{"style":1073},[6097],{"type":998,"value":6098},", Writable: ",{"type":993,"tag":1026,"props":6100,"children":6101},{"style":1061},[6102],{"type":998,"value":1231},{"type":993,"tag":1026,"props":6104,"children":6105},{"style":1067},[6106],{"type":998,"value":6107},"writable",{"type":993,"tag":1026,"props":6109,"children":6110},{"style":1061},[6111],{"type":998,"value":1240},{"type":993,"tag":1026,"props":6113,"children":6114},{"style":1073},[6115],{"type":998,"value":1245},{"type":993,"tag":1026,"props":6117,"children":6118},{"style":1067},[6119],{"type":998,"value":1091},{"type":993,"tag":1026,"props":6121,"children":6122},{"class":1028,"line":694},[6123],{"type":993,"tag":1026,"props":6124,"children":6125},{"style":1067},[6126],{"type":998,"value":6001},{"type":993,"tag":1026,"props":6128,"children":6129},{"class":1028,"line":703},[6130,6135,6139,6143],{"type":993,"tag":1026,"props":6131,"children":6132},{"style":1055},[6133],{"type":998,"value":6134},"            except",{"type":993,"tag":1026,"props":6136,"children":6137},{"style":1061},[6138],{"type":998,"value":5556},{"type":993,"tag":1026,"props":6140,"children":6141},{"style":1055},[6142],{"type":998,"value":5248},{"type":993,"tag":1026,"props":6144,"children":6145},{"style":1067},[6146],{"type":998,"value":5253},{"type":993,"tag":1026,"props":6148,"children":6149},{"class":1028,"line":712},[6150,6154,6158,6162,6167,6171,6175,6179,6183,6187,6191,6195,6199],{"type":993,"tag":1026,"props":6151,"children":6152},{"style":1061},[6153],{"type":998,"value":4584},{"type":993,"tag":1026,"props":6155,"children":6156},{"style":1067},[6157],{"type":998,"value":1070},{"type":993,"tag":1026,"props":6159,"children":6160},{"style":1055},[6161],{"type":998,"value":1221},{"type":993,"tag":1026,"props":6163,"children":6164},{"style":1073},[6165],{"type":998,"value":6166},"\"❌ Error checking ",{"type":993,"tag":1026,"props":6168,"children":6169},{"style":1061},[6170],{"type":998,"value":1231},{"type":993,"tag":1026,"props":6172,"children":6173},{"style":1067},[6174],{"type":998,"value":4978},{"type":993,"tag":1026,"props":6176,"children":6177},{"style":1061},[6178],{"type":998,"value":1240},{"type":993,"tag":1026,"props":6180,"children":6181},{"style":1073},[6182],{"type":998,"value":4613},{"type":993,"tag":1026,"props":6184,"children":6185},{"style":1061},[6186],{"type":998,"value":1231},{"type":993,"tag":1026,"props":6188,"children":6189},{"style":1067},[6190],{"type":998,"value":5282},{"type":993,"tag":1026,"props":6192,"children":6193},{"style":1061},[6194],{"type":998,"value":1240},{"type":993,"tag":1026,"props":6196,"children":6197},{"style":1073},[6198],{"type":998,"value":1245},{"type":993,"tag":1026,"props":6200,"children":6201},{"style":1067},[6202],{"type":998,"value":1091},{"type":993,"tag":1026,"props":6204,"children":6205},{"class":1028,"line":721},[6206,6211],{"type":993,"tag":1026,"props":6207,"children":6208},{"style":1055},[6209],{"type":998,"value":6210},"        else",{"type":993,"tag":1026,"props":6212,"children":6213},{"style":1067},[6214],{"type":998,"value":1324},{"type":993,"tag":1026,"props":6216,"children":6217},{"class":1028,"line":730},[6218,6222,6226,6230,6235,6239,6243,6247,6252],{"type":993,"tag":1026,"props":6219,"children":6220},{"style":1061},[6221],{"type":998,"value":4666},{"type":993,"tag":1026,"props":6223,"children":6224},{"style":1067},[6225],{"type":998,"value":1070},{"type":993,"tag":1026,"props":6227,"children":6228},{"style":1055},[6229],{"type":998,"value":1221},{"type":993,"tag":1026,"props":6231,"children":6232},{"style":1073},[6233],{"type":998,"value":6234},"\"❓ ",{"type":993,"tag":1026,"props":6236,"children":6237},{"style":1061},[6238],{"type":998,"value":1231},{"type":993,"tag":1026,"props":6240,"children":6241},{"style":1067},[6242],{"type":998,"value":4978},{"type":993,"tag":1026,"props":6244,"children":6245},{"style":1061},[6246],{"type":998,"value":1240},{"type":993,"tag":1026,"props":6248,"children":6249},{"style":1073},[6250],{"type":998,"value":6251}," does not exist\"",{"type":993,"tag":1026,"props":6253,"children":6254},{"style":1067},[6255],{"type":998,"value":1091},{"type":993,"tag":1026,"props":6257,"children":6258},{"class":1028,"line":739},[6259],{"type":993,"tag":1026,"props":6260,"children":6261},{"style":1067},[6262],{"type":998,"value":2188},{"type":993,"tag":1026,"props":6264,"children":6265},{"class":1028,"line":749},[6266,6270,6274,6278,6282,6287],{"type":993,"tag":1026,"props":6267,"children":6268},{"style":1061},[6269],{"type":998,"value":1495},{"type":993,"tag":1026,"props":6271,"children":6272},{"style":1067},[6273],{"type":998,"value":1070},{"type":993,"tag":1026,"props":6275,"children":6276},{"style":1073},[6277],{"type":998,"value":1245},{"type":993,"tag":1026,"props":6279,"children":6280},{"style":1061},[6281],{"type":998,"value":1365},{"type":993,"tag":1026,"props":6283,"children":6284},{"style":1073},[6285],{"type":998,"value":6286},"File property checking:\"",{"type":993,"tag":1026,"props":6288,"children":6289},{"style":1067},[6290],{"type":998,"value":1091},{"type":993,"tag":1026,"props":6292,"children":6293},{"class":1028,"line":758},[6294,6299,6303],{"type":993,"tag":1026,"props":6295,"children":6296},{"style":1067},[6297],{"type":998,"value":6298},"    check_file_safely(",{"type":993,"tag":1026,"props":6300,"children":6301},{"style":1073},[6302],{"type":998,"value":5754},{"type":993,"tag":1026,"props":6304,"children":6305},{"style":1067},[6306],{"type":998,"value":1091},{"type":993,"tag":1026,"props":6308,"children":6309},{"class":1028,"line":767},[6310,6314,6318],{"type":993,"tag":1026,"props":6311,"children":6312},{"style":1067},[6313],{"type":998,"value":6298},{"type":993,"tag":1026,"props":6315,"children":6316},{"style":1073},[6317],{"type":998,"value":5810},{"type":993,"tag":1026,"props":6319,"children":6320},{"style":1067},[6321],{"type":998,"value":1091},{"type":993,"tag":1026,"props":6323,"children":6325},{"class":1028,"line":6324},84,[6326],{"type":993,"tag":1026,"props":6327,"children":6328},{"emptyLinePlaceholder":13},[6329],{"type":998,"value":1137},{"type":993,"tag":1026,"props":6331,"children":6332},{"class":1028,"line":776},[6333],{"type":993,"tag":1026,"props":6334,"children":6335},{"style":1067},[6336],{"type":998,"value":6337},"file_error_handling_examples()\n",{"type":993,"tag":1842,"props":6339,"children":6343},{"emoji":6340,"title":6341,"type":6342},"✅","Best Practices","success",[6344,6352,6382,6390,6413,6421,6444,6452],{"type":993,"tag":1001,"props":6345,"children":6346},{},[6347],{"type":993,"tag":1852,"props":6348,"children":6349},{},[6350],{"type":998,"value":6351},"File Basics Guidelines:",{"type":993,"tag":1866,"props":6353,"children":6354},{},[6355,6367,6372,6377],{"type":993,"tag":1870,"props":6356,"children":6357},{},[6358,6360,6365],{"type":998,"value":6359},"Always use context managers (",{"type":993,"tag":1022,"props":6361,"children":6363},{"className":6362},[],[6364],{"type":998,"value":1284},{"type":998,"value":6366}," statements) for automatic file closing",{"type":993,"tag":1870,"props":6368,"children":6369},{},[6370],{"type":998,"value":6371},"Specify text encoding explicitly (UTF-8 recommended)",{"type":993,"tag":1870,"props":6373,"children":6374},{},[6375],{"type":998,"value":6376},"Handle file exceptions with appropriate try/except blocks",{"type":993,"tag":1870,"props":6378,"children":6379},{},[6380],{"type":998,"value":6381},"Choose the correct file mode for your specific operation",{"type":993,"tag":1001,"props":6383,"children":6384},{},[6385],{"type":993,"tag":1852,"props":6386,"children":6387},{},[6388],{"type":998,"value":6389},"Error Prevention:",{"type":993,"tag":1866,"props":6391,"children":6392},{},[6393,6398,6403,6408],{"type":993,"tag":1870,"props":6394,"children":6395},{},[6396],{"type":998,"value":6397},"Check file existence before attempting to read",{"type":993,"tag":1870,"props":6399,"children":6400},{},[6401],{"type":998,"value":6402},"Validate file paths and names before operations",{"type":993,"tag":1870,"props":6404,"children":6405},{},[6406],{"type":998,"value":6407},"Use absolute paths when working across directories",{"type":993,"tag":1870,"props":6409,"children":6410},{},[6411],{"type":998,"value":6412},"Test file permissions before attempting write operations",{"type":993,"tag":1001,"props":6414,"children":6415},{},[6416],{"type":993,"tag":1852,"props":6417,"children":6418},{},[6419],{"type":998,"value":6420},"Performance Tips:",{"type":993,"tag":1866,"props":6422,"children":6423},{},[6424,6429,6434,6439],{"type":993,"tag":1870,"props":6425,"children":6426},{},[6427],{"type":998,"value":6428},"Close files promptly to free system resources",{"type":993,"tag":1870,"props":6430,"children":6431},{},[6432],{"type":998,"value":6433},"Use appropriate buffer sizes for large file operations",{"type":993,"tag":1870,"props":6435,"children":6436},{},[6437],{"type":998,"value":6438},"Consider memory usage when reading large files",{"type":993,"tag":1870,"props":6440,"children":6441},{},[6442],{"type":998,"value":6443},"Use binary mode for non-text files",{"type":993,"tag":1001,"props":6445,"children":6446},{},[6447],{"type":993,"tag":1852,"props":6448,"children":6449},{},[6450],{"type":998,"value":6451},"Security Considerations:",{"type":993,"tag":1866,"props":6453,"children":6454},{},[6455,6460,6465,6470],{"type":993,"tag":1870,"props":6456,"children":6457},{},[6458],{"type":998,"value":6459},"Validate user-provided file paths",{"type":993,"tag":1870,"props":6461,"children":6462},{},[6463],{"type":998,"value":6464},"Be cautious with file permissions and access rights",{"type":993,"tag":1870,"props":6466,"children":6467},{},[6468],{"type":998,"value":6469},"Sanitize file names to prevent path traversal attacks",{"type":993,"tag":1870,"props":6471,"children":6472},{},[6473],{"type":998,"value":6474},"Use temporary files for sensitive operations when appropriate",{"type":993,"tag":1830,"props":6476,"children":6478},{"id":6477},"essential-file-operations-methods",[6479],{"type":998,"value":6480},"Essential File Operations Methods",{"type":993,"tag":1001,"props":6482,"children":6483},{},[6484],{"type":998,"value":6485},"Understanding core file methods enables effective file handling and proper resource management in Python applications.",{"type":993,"tag":6487,"props":6488,"children":6489},"table",{},[6490,6519],{"type":993,"tag":6491,"props":6492,"children":6493},"thead",{},[6494],{"type":993,"tag":6495,"props":6496,"children":6497},"tr",{},[6498,6504,6509,6514],{"type":993,"tag":6499,"props":6500,"children":6501},"th",{},[6502],{"type":998,"value":6503},"Method",{"type":993,"tag":6499,"props":6505,"children":6506},{},[6507],{"type":998,"value":6508},"Purpose",{"type":993,"tag":6499,"props":6510,"children":6511},{},[6512],{"type":998,"value":6513},"Example",{"type":993,"tag":6499,"props":6515,"children":6516},{},[6517],{"type":998,"value":6518},"Best Practice",{"type":993,"tag":6520,"props":6521,"children":6522},"tbody",{},[6523,6555,6586,6617,6648,6679,6710,6741],{"type":993,"tag":6495,"props":6524,"children":6525},{},[6526,6536,6541,6550],{"type":993,"tag":6527,"props":6528,"children":6529},"td",{},[6530],{"type":993,"tag":1022,"props":6531,"children":6533},{"className":6532},[],[6534],{"type":998,"value":6535},"open(file, mode)",{"type":993,"tag":6527,"props":6537,"children":6538},{},[6539],{"type":998,"value":6540},"Open file with specified mode",{"type":993,"tag":6527,"props":6542,"children":6543},{},[6544],{"type":993,"tag":1022,"props":6545,"children":6547},{"className":6546},[],[6548],{"type":998,"value":6549},"open(\"data.txt\", \"r\")",{"type":993,"tag":6527,"props":6551,"children":6552},{},[6553],{"type":998,"value":6554},"Always use with context manager",{"type":993,"tag":6495,"props":6556,"children":6557},{},[6558,6567,6572,6581],{"type":993,"tag":6527,"props":6559,"children":6560},{},[6561],{"type":993,"tag":1022,"props":6562,"children":6564},{"className":6563},[],[6565],{"type":998,"value":6566},"file.read()",{"type":993,"tag":6527,"props":6568,"children":6569},{},[6570],{"type":998,"value":6571},"Read entire file content",{"type":993,"tag":6527,"props":6573,"children":6574},{},[6575],{"type":993,"tag":1022,"props":6576,"children":6578},{"className":6577},[],[6579],{"type":998,"value":6580},"content = file.read()",{"type":993,"tag":6527,"props":6582,"children":6583},{},[6584],{"type":998,"value":6585},"Good for small files",{"type":993,"tag":6495,"props":6587,"children":6588},{},[6589,6598,6603,6612],{"type":993,"tag":6527,"props":6590,"children":6591},{},[6592],{"type":993,"tag":1022,"props":6593,"children":6595},{"className":6594},[],[6596],{"type":998,"value":6597},"file.readline()",{"type":993,"tag":6527,"props":6599,"children":6600},{},[6601],{"type":998,"value":6602},"Read single line",{"type":993,"tag":6527,"props":6604,"children":6605},{},[6606],{"type":993,"tag":1022,"props":6607,"children":6609},{"className":6608},[],[6610],{"type":998,"value":6611},"line = file.readline()",{"type":993,"tag":6527,"props":6613,"children":6614},{},[6615],{"type":998,"value":6616},"Process files line by line",{"type":993,"tag":6495,"props":6618,"children":6619},{},[6620,6629,6634,6643],{"type":993,"tag":6527,"props":6621,"children":6622},{},[6623],{"type":993,"tag":1022,"props":6624,"children":6626},{"className":6625},[],[6627],{"type":998,"value":6628},"file.readlines()",{"type":993,"tag":6527,"props":6630,"children":6631},{},[6632],{"type":998,"value":6633},"Read all lines into list",{"type":993,"tag":6527,"props":6635,"children":6636},{},[6637],{"type":993,"tag":1022,"props":6638,"children":6640},{"className":6639},[],[6641],{"type":998,"value":6642},"lines = file.readlines()",{"type":993,"tag":6527,"props":6644,"children":6645},{},[6646],{"type":998,"value":6647},"Use for small to medium files",{"type":993,"tag":6495,"props":6649,"children":6650},{},[6651,6660,6665,6674],{"type":993,"tag":6527,"props":6652,"children":6653},{},[6654],{"type":993,"tag":1022,"props":6655,"children":6657},{"className":6656},[],[6658],{"type":998,"value":6659},"file.write(text)",{"type":993,"tag":6527,"props":6661,"children":6662},{},[6663],{"type":998,"value":6664},"Write text to file",{"type":993,"tag":6527,"props":6666,"children":6667},{},[6668],{"type":993,"tag":1022,"props":6669,"children":6671},{"className":6670},[],[6672],{"type":998,"value":6673},"file.write(\"Hello\")",{"type":993,"tag":6527,"props":6675,"children":6676},{},[6677],{"type":998,"value":6678},"Returns number of characters written",{"type":993,"tag":6495,"props":6680,"children":6681},{},[6682,6691,6696,6705],{"type":993,"tag":6527,"props":6683,"children":6684},{},[6685],{"type":993,"tag":1022,"props":6686,"children":6688},{"className":6687},[],[6689],{"type":998,"value":6690},"file.writelines(list)",{"type":993,"tag":6527,"props":6692,"children":6693},{},[6694],{"type":998,"value":6695},"Write list of strings",{"type":993,"tag":6527,"props":6697,"children":6698},{},[6699],{"type":993,"tag":1022,"props":6700,"children":6702},{"className":6701},[],[6703],{"type":998,"value":6704},"file.writelines(lines)",{"type":993,"tag":6527,"props":6706,"children":6707},{},[6708],{"type":998,"value":6709},"Add newlines manually if needed",{"type":993,"tag":6495,"props":6711,"children":6712},{},[6713,6722,6727,6736],{"type":993,"tag":6527,"props":6714,"children":6715},{},[6716],{"type":993,"tag":1022,"props":6717,"children":6719},{"className":6718},[],[6720],{"type":998,"value":6721},"file.seek(position)",{"type":993,"tag":6527,"props":6723,"children":6724},{},[6725],{"type":998,"value":6726},"Move to position in file",{"type":993,"tag":6527,"props":6728,"children":6729},{},[6730],{"type":993,"tag":1022,"props":6731,"children":6733},{"className":6732},[],[6734],{"type":998,"value":6735},"file.seek(0)",{"type":993,"tag":6527,"props":6737,"children":6738},{},[6739],{"type":998,"value":6740},"Reset to beginning",{"type":993,"tag":6495,"props":6742,"children":6743},{},[6744,6753,6758,6767],{"type":993,"tag":6527,"props":6745,"children":6746},{},[6747],{"type":993,"tag":1022,"props":6748,"children":6750},{"className":6749},[],[6751],{"type":998,"value":6752},"file.tell()",{"type":993,"tag":6527,"props":6754,"children":6755},{},[6756],{"type":998,"value":6757},"Get current position",{"type":993,"tag":6527,"props":6759,"children":6760},{},[6761],{"type":993,"tag":1022,"props":6762,"children":6764},{"className":6763},[],[6765],{"type":998,"value":6766},"pos = file.tell()",{"type":993,"tag":6527,"props":6768,"children":6769},{},[6770],{"type":998,"value":6771},"Track file pointer location",{"type":993,"tag":6773,"props":6774,"children":6776},"content-exercise",{":widget-view":6775,"category":6,"id":821},"true",[],{"type":993,"tag":1001,"props":6778,"children":6779},{},[6780,6782,6788],{"type":998,"value":6781},"Learn more about ",{"type":993,"tag":6783,"props":6784,"children":6785},"a",{"href":827},[6786],{"type":998,"value":6787},"reading files",{"type":998,"value":6789}," to explore advanced techniques for processing file content efficiently.",{"type":993,"tag":1830,"props":6791,"children":6793},{"id":6792},"test-your-knowledge",[6794],{"type":998,"value":6795},"Test Your Knowledge",{"type":993,"tag":1001,"props":6797,"children":6798},{},[6799],{"type":998,"value":6800},"Test what you've learned about file basics:",{"type":993,"tag":6802,"props":6803,"children":6807},"redirect-button",{"icon":6804,"label":6805,"url":6806},"pi pi-send","Take Quiz","/tutorial-quiz/python/file-basics",[],{"type":993,"tag":1830,"props":6809,"children":6811},{"id":6810},"whats-next",[6812],{"type":998,"value":6813},"What's Next?",{"type":993,"tag":1001,"props":6815,"children":6816},{},[6817],{"type":998,"value":6818},"Now that you understand file basics, you're ready to explore reading files in detail. Learn how to process file content efficiently, handle different file formats, and work with large files.",{"type":993,"tag":1001,"props":6820,"children":6821},{},[6822,6824,6828],{"type":998,"value":6823},"Ready to continue? Check out our lesson on ",{"type":993,"tag":6783,"props":6825,"children":6826},{"href":827},[6827],{"type":998,"value":828},{"type":998,"value":6829},".",{"type":993,"tag":6831,"props":6832,"children":6833},"style",{},[6834],{"type":998,"value":6835},"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":6837},[6838,6842,6843,6844,6845,6846],{"id":1832,"depth":27,"text":1835,"children":6839},[6840,6841],{"id":2135,"depth":36,"text":2138},{"id":2746,"depth":36,"text":2749},{"id":3582,"depth":27,"text":3585},{"id":4773,"depth":27,"text":4776},{"id":6477,"depth":27,"text":6480},{"id":6792,"depth":27,"text":6795},{"id":6810,"depth":27,"text":6813},1782373750409]