[{"data":1,"prerenderedAt":4153},["ShallowReactive",2],{"tutorials-python-how-to":3,"category-items-python-how-to":600,"content-/python-how-to/handle-exceptions":601},[4,22,31,40,49,58,67,76,86,94,103,112,121,130,139,148,158,167,176,185,194,203,212,222,231,240,249,258,267,276,285,297,306,315,324,333,342,351,362,371,380,389,398,407,418,427,436,445,454,463,472,483,492,501,510,519,528,539,548,557,566,575,584,593],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"slug":11,"order":12,"isParent":13,"icon":14,"_type":15,"_id":16,"_source":17,"_file":18,"_stem":19,"_extension":20,"children":21,"expanded":13},"/python-how-to/string-manipulation","python-how-to",false,"","String Manipulation","Learn essential string manipulation techniques in Python","string-manipulation",1,true,"pi pi-folder","markdown","content:python-how-to:1.string-manipulation.md","content","python-how-to/1.string-manipulation.md","python-how-to/1.string-manipulation","md",[22,31,40,49,58,67],{"_path":23,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":24,"description":25,"slug":26,"parentId":5,"order":27,"_type":15,"_id":28,"_source":17,"_file":29,"_stem":30,"_extension":20},"/python-how-to/split-join-strings","Split and Join Strings","Learn how to split strings into lists and join lists back into strings in Python","split-join-strings",2,"content:python-how-to:2.split-join-strings.md","python-how-to/2.split-join-strings.md","python-how-to/2.split-join-strings",{"_path":32,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":33,"description":34,"slug":35,"parentId":5,"order":36,"_type":15,"_id":37,"_source":17,"_file":38,"_stem":39,"_extension":20},"/python-how-to/remove-whitespace","Remove Whitespace","Learn how to clean up and remove unwanted whitespace from strings in Python","remove-whitespace",3,"content:python-how-to:3.remove-whitespace.md","python-how-to/3.remove-whitespace.md","python-how-to/3.remove-whitespace",{"_path":41,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":42,"description":43,"slug":44,"parentId":5,"order":45,"_type":15,"_id":46,"_source":17,"_file":47,"_stem":48,"_extension":20},"/python-how-to/find-replace-text","Find and Replace Text","Learn how to search for and replace text within strings in Python","find-replace-text",4,"content:python-how-to:4.find-replace-text.md","python-how-to/4.find-replace-text.md","python-how-to/4.find-replace-text",{"_path":50,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":51,"description":52,"slug":53,"parentId":5,"order":54,"_type":15,"_id":55,"_source":17,"_file":56,"_stem":57,"_extension":20},"/python-how-to/check-string-content","Check String Content","Learn how to validate and check the content of strings in Python","check-string-content",5,"content:python-how-to:5.check-string-content.md","python-how-to/5.check-string-content.md","python-how-to/5.check-string-content",{"_path":59,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":60,"description":61,"slug":62,"parentId":5,"order":63,"_type":15,"_id":64,"_source":17,"_file":65,"_stem":66,"_extension":20},"/python-how-to/format-strings","Format Strings","Learn how to format strings in Python using f-strings and format() method","format-strings",6,"content:python-how-to:6.format-strings.md","python-how-to/6.format-strings.md","python-how-to/6.format-strings",{"_path":68,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":69,"description":70,"slug":71,"parentId":5,"order":72,"_type":15,"_id":73,"_source":17,"_file":74,"_stem":75,"_extension":20},"/python-how-to/unicode-special-chars","Handle Unicode and Special Characters","Learn how to work with Unicode and special characters in Python strings","unicode-special-chars",7,"content:python-how-to:7.unicode-special-chars.md","python-how-to/7.unicode-special-chars.md","python-how-to/7.unicode-special-chars",{"_path":77,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":78,"description":79,"slug":80,"order":81,"isParent":13,"icon":14,"_type":15,"_id":82,"_source":17,"_file":83,"_stem":84,"_extension":20,"children":85,"expanded":13},"/python-how-to/list-operations","List Operations","Learn essential operations for working with lists in Python","list-operations",8,"content:python-how-to:8.list-operations.md","python-how-to/8.list-operations.md","python-how-to/8.list-operations",[86,94,103,112,121,130,139],{"_path":87,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":88,"description":89,"slug":90,"parentId":77,"order":81,"_type":15,"_id":91,"_source":17,"_file":92,"_stem":93,"_extension":20},"/python-how-to/sort-lists","Sort Lists","Learn how to sort lists in Python using different methods and custom sorting","sort-lists","content:python-how-to:9.sort-lists.md","python-how-to/9.sort-lists.md","python-how-to/9.sort-lists",{"_path":95,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":96,"description":97,"slug":98,"parentId":77,"order":99,"_type":15,"_id":100,"_source":17,"_file":101,"_stem":102,"_extension":20},"/python-how-to/remove-duplicates","Remove Duplicates","Learn how to remove duplicate elements from lists in Python","remove-duplicates",10,"content:python-how-to:10.remove-duplicates.md","python-how-to/10.remove-duplicates.md","python-how-to/10.remove-duplicates",{"_path":104,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":105,"description":106,"slug":107,"parentId":77,"order":108,"_type":15,"_id":109,"_source":17,"_file":110,"_stem":111,"_extension":20},"/python-how-to/filter-lists","Filter Lists","Learn how to filter lists in Python using different methods","filter-lists",11,"content:python-how-to:11.filter-lists.md","python-how-to/11.filter-lists.md","python-how-to/11.filter-lists",{"_path":113,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":114,"description":115,"slug":116,"parentId":77,"order":117,"_type":15,"_id":118,"_source":17,"_file":119,"_stem":120,"_extension":20},"/python-how-to/combine-lists","Combine Lists","Learn different methods to combine lists in Python","combine-lists",12,"content:python-how-to:12.combine-lists.md","python-how-to/12.combine-lists.md","python-how-to/12.combine-lists",{"_path":122,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":123,"description":124,"slug":125,"parentId":77,"order":126,"_type":15,"_id":127,"_source":17,"_file":128,"_stem":129,"_extension":20},"/python-how-to/list-comprehensions","Use List Comprehensions","Learn how to create and transform lists efficiently using Python's list comprehension syntax","list-comprehensions",13,"content:python-how-to:13.list-comprehensions.md","python-how-to/13.list-comprehensions.md","python-how-to/13.list-comprehensions",{"_path":131,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":132,"description":133,"slug":134,"parentId":77,"order":135,"_type":15,"_id":136,"_source":17,"_file":137,"_stem":138,"_extension":20},"/python-how-to/nested-lists","Work with Nested Lists","Learn how to work with nested lists (2D arrays) in Python","nested-lists",14,"content:python-how-to:14.nested-lists.md","python-how-to/14.nested-lists.md","python-how-to/14.nested-lists",{"_path":140,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":141,"description":142,"slug":143,"parentId":77,"order":144,"_type":15,"_id":145,"_source":17,"_file":146,"_stem":147,"_extension":20},"/python-how-to/enumerate-zip","Use enumerate() and zip()","Learn how to use enumerate() and zip() for efficient iteration in Python","enumerate-zip",15,"content:python-how-to:15.enumerate-zip.md","python-how-to/15.enumerate-zip.md","python-how-to/15.enumerate-zip",{"_path":149,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":150,"description":151,"slug":152,"order":153,"isParent":13,"icon":14,"_type":15,"_id":154,"_source":17,"_file":155,"_stem":156,"_extension":20,"children":157,"expanded":13},"/python-how-to/dictionary-operations","Dictionary Operations","Learn essential operations for working with dictionaries in Python","dictionary-operations",16,"content:python-how-to:16.dictionary-operations.md","python-how-to/16.dictionary-operations.md","python-how-to/16.dictionary-operations",[158,167,176,185,194,203],{"_path":159,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":160,"description":161,"slug":162,"parentId":149,"order":163,"_type":15,"_id":164,"_source":17,"_file":165,"_stem":166,"_extension":20},"/python-how-to/merge-dictionaries","Merge Dictionaries","Learn different methods to merge dictionaries in Python","merge-dictionaries",17,"content:python-how-to:17.merge-dictionaries.md","python-how-to/17.merge-dictionaries.md","python-how-to/17.merge-dictionaries",{"_path":168,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":169,"description":170,"slug":171,"parentId":149,"order":172,"_type":15,"_id":173,"_source":17,"_file":174,"_stem":175,"_extension":20},"/python-how-to/sort-dictionaries","Sort Dictionaries","Learn how to sort dictionaries by keys or values in Python","sort-dictionaries",18,"content:python-how-to:18.sort-dictionaries.md","python-how-to/18.sort-dictionaries.md","python-how-to/18.sort-dictionaries",{"_path":177,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":178,"description":179,"slug":180,"parentId":149,"order":181,"_type":15,"_id":182,"_source":17,"_file":183,"_stem":184,"_extension":20},"/python-how-to/filter-dictionaries","Filter Dictionaries","Learn how to filter dictionaries based on keys or values in Python","filter-dictionaries",19,"content:python-how-to:19.filter-dictionaries.md","python-how-to/19.filter-dictionaries.md","python-how-to/19.filter-dictionaries",{"_path":186,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":187,"description":188,"slug":189,"parentId":149,"order":190,"_type":15,"_id":191,"_source":17,"_file":192,"_stem":193,"_extension":20},"/python-how-to/handle-missing-keys","Handle Missing Keys","Learn safe ways to access dictionary keys and handle missing values","handle-missing-keys",20,"content:python-how-to:20.handle-missing-keys.md","python-how-to/20.handle-missing-keys.md","python-how-to/20.handle-missing-keys",{"_path":195,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":196,"description":197,"slug":198,"parentId":149,"order":199,"_type":15,"_id":200,"_source":17,"_file":201,"_stem":202,"_extension":20},"/python-how-to/dictionary-comprehensions","Use Dictionary Comprehensions","Learn how to create dictionaries efficiently using comprehensions","dictionary-comprehensions",21,"content:python-how-to:21.dictionary-comprehensions.md","python-how-to/21.dictionary-comprehensions.md","python-how-to/21.dictionary-comprehensions",{"_path":204,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":205,"description":206,"slug":207,"parentId":149,"order":208,"_type":15,"_id":209,"_source":17,"_file":210,"_stem":211,"_extension":20},"/python-how-to/convert-lists-dictionaries","Convert Between Lists and Dictionaries","Learn how to transform data between lists and dictionaries in Python","convert-lists-dictionaries",22,"content:python-how-to:22.convert-lists-dictionaries.md","python-how-to/22.convert-lists-dictionaries.md","python-how-to/22.convert-lists-dictionaries",{"_path":213,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":214,"description":215,"slug":216,"order":217,"isParent":13,"icon":14,"_type":15,"_id":218,"_source":17,"_file":219,"_stem":220,"_extension":20,"children":221,"expanded":13},"/python-how-to/file-operations","File Operations","Learn essential file operations in Python for reading, writing, and managing files","file-operations",23,"content:python-how-to:23.file-operations.md","python-how-to/23.file-operations.md","python-how-to/23.file-operations",[222,231,240,249,258,267,276],{"_path":223,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":224,"description":225,"slug":226,"parentId":213,"order":227,"_type":15,"_id":228,"_source":17,"_file":229,"_stem":230,"_extension":20},"/python-how-to/read-text-files","Read Text Files","Learn how to read text files in Python using different methods","read-text-files",24,"content:python-how-to:24.read-text-files.md","python-how-to/24.read-text-files.md","python-how-to/24.read-text-files",{"_path":232,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":233,"description":234,"slug":235,"parentId":213,"order":236,"_type":15,"_id":237,"_source":17,"_file":238,"_stem":239,"_extension":20},"/python-how-to/write-to-files","Write to Files","Learn how to write and create files in Python using different methods","write-to-files",25,"content:python-how-to:25.write-to-files.md","python-how-to/25.write-to-files.md","python-how-to/25.write-to-files",{"_path":241,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":242,"description":243,"slug":244,"parentId":213,"order":245,"_type":15,"_id":246,"_source":17,"_file":247,"_stem":248,"_extension":20},"/python-how-to/work-csv-files","Work with CSV Files","Learn how to read and write CSV files in Python using the csv module","work-csv-files",26,"content:python-how-to:26.work-csv-files.md","python-how-to/26.work-csv-files.md","python-how-to/26.work-csv-files",{"_path":250,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":251,"description":252,"slug":253,"parentId":213,"order":254,"_type":15,"_id":255,"_source":17,"_file":256,"_stem":257,"_extension":20},"/python-how-to/handle-file-paths","Handle File Paths","Learn how to work with file and directory paths in Python using pathlib and os modules","handle-file-paths",27,"content:python-how-to:27.handle-file-paths.md","python-how-to/27.handle-file-paths.md","python-how-to/27.handle-file-paths",{"_path":259,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":260,"description":261,"slug":262,"parentId":213,"order":263,"_type":15,"_id":264,"_source":17,"_file":265,"_stem":266,"_extension":20},"/python-how-to/work-json-files","Work with JSON Files","Learn how to read and write JSON files in Python using the json module","work-json-files",28,"content:python-how-to:28.work-json-files.md","python-how-to/28.work-json-files.md","python-how-to/28.work-json-files",{"_path":268,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":269,"description":270,"slug":271,"parentId":213,"order":272,"_type":15,"_id":273,"_source":17,"_file":274,"_stem":275,"_extension":20},"/python-how-to/handle-binary-files","Handle Binary Files","Learn how to work with binary files in Python for images, data, and other non-text content","handle-binary-files",29,"content:python-how-to:29.handle-binary-files.md","python-how-to/29.handle-binary-files.md","python-how-to/29.handle-binary-files",{"_path":277,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":278,"description":279,"slug":280,"parentId":213,"order":281,"_type":15,"_id":282,"_source":17,"_file":283,"_stem":284,"_extension":20},"/python-how-to/use-context-managers","Use Context Managers","Learn how to use context managers for safe resource handling in Python","use-context-managers",30,"content:python-how-to:30.use-context-managers.md","python-how-to/30.use-context-managers.md","python-how-to/30.use-context-managers",{"_path":286,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":287,"description":288,"slug":289,"parentId":290,"order":291,"isParent":13,"icon":292,"_type":15,"_id":293,"_source":17,"_file":294,"_stem":295,"_extension":20,"children":296,"expanded":13},"/python-how-to/date-and-time","Date and Time","Master Python's date and time handling with datetime, time zones, formatting, and calculations","date-and-time","/python-how-to",31,"pi pi-calendar","content:python-how-to:31.date-and-time.md","python-how-to/31.date-and-time.md","python-how-to/31.date-and-time",[297,306,315,324,333,342],{"_path":298,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":299,"description":300,"slug":301,"parentId":286,"order":302,"_type":15,"_id":303,"_source":17,"_file":304,"_stem":305,"_extension":20},"/python-how-to/get-current-datetime","Get Current Date/Time","Learn how to get current date, time, and timestamps using Python's datetime module","get-current-datetime",32,"content:python-how-to:32.get-current-datetime.md","python-how-to/32.get-current-datetime.md","python-how-to/32.get-current-datetime",{"_path":307,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":308,"description":309,"slug":310,"parentId":286,"order":311,"_type":15,"_id":312,"_source":17,"_file":313,"_stem":314,"_extension":20},"/python-how-to/format-dates","Format Dates","Master date formatting with strftime, custom formats, and locale-aware formatting for user-friendly displays","format-dates",33,"content:python-how-to:33.format-dates.md","python-how-to/33.format-dates.md","python-how-to/33.format-dates",{"_path":316,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":317,"description":318,"slug":319,"parentId":286,"order":320,"_type":15,"_id":321,"_source":17,"_file":322,"_stem":323,"_extension":20},"/python-how-to/calculate-date-differences","Calculate Date Differences","Learn to calculate time differences, durations, and intervals using Python's timedelta for scheduling and analytics","calculate-date-differences",34,"content:python-how-to:34.calculate-date-differences.md","python-how-to/34.calculate-date-differences.md","python-how-to/34.calculate-date-differences",{"_path":325,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":326,"description":327,"slug":328,"parentId":286,"order":329,"_type":15,"_id":330,"_source":17,"_file":331,"_stem":332,"_extension":20},"/python-how-to/parse-date-strings","Parse Date Strings","Convert text dates into Python datetime objects using strptime, handle multiple formats, and validate date input","parse-date-strings",35,"content:python-how-to:35.parse-date-strings.md","python-how-to/35.parse-date-strings.md","python-how-to/35.parse-date-strings",{"_path":334,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":335,"description":336,"slug":337,"parentId":286,"order":338,"_type":15,"_id":339,"_source":17,"_file":340,"_stem":341,"_extension":20},"/python-how-to/handle-timezones","Handle Timezones","Master timezone handling with zoneinfo, UTC conversions, and timezone-aware datetime objects for global applications","handle-timezones",36,"content:python-how-to:36.handle-timezones.md","python-how-to/36.handle-timezones.md","python-how-to/36.handle-timezones",{"_path":343,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":344,"description":345,"slug":346,"parentId":286,"order":347,"_type":15,"_id":348,"_source":17,"_file":349,"_stem":350,"_extension":20},"/python-how-to/work-with-timestamps","Work with Timestamps","Master Unix timestamps in Python - convert between datetime objects and timestamps for APIs, databases, and system integration","work-with-timestamps",37,"content:python-how-to:37.work-with-timestamps.md","python-how-to/37.work-with-timestamps.md","python-how-to/37.work-with-timestamps",{"_path":352,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":353,"description":354,"slug":355,"parentId":290,"order":356,"isParent":13,"icon":357,"_type":15,"_id":358,"_source":17,"_file":359,"_stem":360,"_extension":20,"children":361,"expanded":13},"/python-how-to/error-handling","Error Handling","Learn Python's error handling with try/except, custom exceptions, debugging, logging, and retry logic for robust applications","error-handling",38,"pi pi-exclamation-triangle","content:python-how-to:38.error-handling.md","python-how-to/38.error-handling.md","python-how-to/38.error-handling",[362,371,380,389,398],{"_path":363,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":364,"description":365,"slug":366,"parentId":352,"order":367,"_type":15,"_id":368,"_source":17,"_file":369,"_stem":370,"_extension":20},"/python-how-to/handle-exceptions","Handle Exceptions","Master try/except blocks, multiple exception handling, and finally clauses for robust error handling in Python","handle-exceptions",39,"content:python-how-to:39.handle-exceptions.md","python-how-to/39.handle-exceptions.md","python-how-to/39.handle-exceptions",{"_path":372,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":373,"description":374,"slug":375,"parentId":352,"order":376,"_type":15,"_id":377,"_source":17,"_file":378,"_stem":379,"_extension":20},"/python-how-to/create-custom-exceptions","Create Custom Exceptions","Learn to create custom exception classes in Python for specific error handling and better code organization","create-custom-exceptions",40,"content:python-how-to:40.create-custom-exceptions.md","python-how-to/40.create-custom-exceptions.md","python-how-to/40.create-custom-exceptions",{"_path":381,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":382,"description":383,"slug":384,"parentId":352,"order":385,"_type":15,"_id":386,"_source":17,"_file":387,"_stem":388,"_extension":20},"/python-how-to/debug-code","Debug Code","Learn Python debugging techniques using print statements, the debugger, and tools to find and fix code issues","debug-code",41,"content:python-how-to:41.debug-code.md","python-how-to/41.debug-code.md","python-how-to/41.debug-code",{"_path":390,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":391,"description":392,"slug":393,"parentId":352,"order":394,"_type":15,"_id":395,"_source":17,"_file":396,"_stem":397,"_extension":20},"/python-how-to/use-logging","Use Logging","Learn Python's logging module for tracking application behavior, errors, and debugging information","use-logging",42,"content:python-how-to:42.use-logging.md","python-how-to/42.use-logging.md","python-how-to/42.use-logging",{"_path":399,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":400,"description":401,"slug":402,"parentId":352,"order":403,"_type":15,"_id":404,"_source":17,"_file":405,"_stem":406,"_extension":20},"/python-how-to/implement-retry-logic","Implement Retry Logic","Learn to implement retry mechanisms in Python for handling temporary failures and building resilient applications","implement-retry-logic",43,"content:python-how-to:43.implement-retry-logic.md","python-how-to/43.implement-retry-logic.md","python-how-to/43.implement-retry-logic",{"_path":408,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":409,"description":410,"slug":411,"parentId":290,"order":412,"isParent":13,"icon":413,"_type":15,"_id":414,"_source":17,"_file":415,"_stem":416,"_extension":20,"children":417},"/python-how-to/functions-and-modules","Functions and Modules","Learn Python functions, modules, and code organization for building reusable, maintainable applications","functions-and-modules",44,"pi pi-box","content:python-how-to:44.functions-and-modules.md","python-how-to/44.functions-and-modules.md","python-how-to/44.functions-and-modules",[418,427,436,445,454,463],{"_path":419,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":420,"description":421,"slug":422,"parentId":408,"order":423,"_type":15,"_id":424,"_source":17,"_file":425,"_stem":426,"_extension":20},"/python-how-to/write-functions","Write Functions","Learn to create Python functions with parameters, return values, and documentation for reusable code","write-functions",45,"content:python-how-to:45.write-functions.md","python-how-to/45.write-functions.md","python-how-to/45.write-functions",{"_path":428,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":429,"description":430,"slug":431,"parentId":408,"order":432,"_type":15,"_id":433,"_source":17,"_file":434,"_stem":435,"_extension":20},"/python-how-to/use-args-kwargs","Use *args and **kwargs","Learn to use *args and **kwargs for flexible function arguments in Python","use-args-kwargs",46,"content:python-how-to:46.use-args-kwargs.md","python-how-to/46.use-args-kwargs.md","python-how-to/46.use-args-kwargs",{"_path":437,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":438,"description":439,"slug":440,"parentId":408,"order":441,"_type":15,"_id":442,"_source":17,"_file":443,"_stem":444,"_extension":20},"/python-how-to/create-decorators","Create Decorators","Learn to create and use Python decorators to enhance function behavior and add functionality","create-decorators",47,"content:python-how-to:47.create-decorators.md","python-how-to/47.create-decorators.md","python-how-to/47.create-decorators",{"_path":446,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":447,"description":448,"slug":449,"parentId":408,"order":450,"_type":15,"_id":451,"_source":17,"_file":452,"_stem":453,"_extension":20},"/python-how-to/use-generators","Use Generators","Learn to create memory-efficient generators with yield for processing large datasets and sequences","use-generators",48,"content:python-how-to:48.use-generators.md","python-how-to/48.use-generators.md","python-how-to/48.use-generators",{"_path":455,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":456,"description":457,"slug":458,"parentId":408,"order":459,"_type":15,"_id":460,"_source":17,"_file":461,"_stem":462,"_extension":20},"/python-how-to/work-modules-packages","Work with Modules and Packages","Learn to organize Python code with modules and packages, and use imports effectively","work-modules-packages",49,"content:python-how-to:49.work-modules-packages.md","python-how-to/49.work-modules-packages.md","python-how-to/49.work-modules-packages",{"_path":464,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":465,"description":466,"slug":467,"parentId":408,"order":468,"_type":15,"_id":469,"_source":17,"_file":470,"_stem":471,"_extension":20},"/python-how-to/create-virtual-environments","Create Virtual Environments","Learn to create and manage Python virtual environments for project dependency isolation","create-virtual-environments",50,"content:python-how-to:50.create-virtual-environments.md","python-how-to/50.create-virtual-environments.md","python-how-to/50.create-virtual-environments",{"_path":473,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":474,"description":475,"slug":476,"parentId":290,"order":477,"isParent":13,"icon":478,"_type":15,"_id":479,"_source":17,"_file":480,"_stem":481,"_extension":20,"children":482},"/python-how-to/data-processing","Data Processing","Learn Python data processing techniques including regex, APIs, databases, and large file handling","data-processing",51,"pi pi-database","content:python-how-to:51.data-processing.md","python-how-to/51.data-processing.md","python-how-to/51.data-processing",[483,492,501,510,519],{"_path":484,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":485,"description":486,"slug":487,"parentId":473,"order":488,"_type":15,"_id":489,"_source":17,"_file":490,"_stem":491,"_extension":20},"/python-how-to/work-regular-expressions","Work with Regular Expressions","Learn to use Python's re module for pattern matching, text extraction, and data validation","work-regular-expressions",52,"content:python-how-to:52.work-regular-expressions.md","python-how-to/52.work-regular-expressions.md","python-how-to/52.work-regular-expressions",{"_path":493,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":494,"description":495,"slug":496,"parentId":473,"order":497,"_type":15,"_id":498,"_source":17,"_file":499,"_stem":500,"_extension":20},"/python-how-to/parse-xml-html","Parse XML and HTML","Learn to extract data from XML and HTML documents using Python's built-in parsing tools","parse-xml-html",53,"content:python-how-to:53.parse-xml-html.md","python-how-to/53.parse-xml-html.md","python-how-to/53.parse-xml-html",{"_path":502,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":503,"description":504,"slug":505,"parentId":473,"order":506,"_type":15,"_id":507,"_source":17,"_file":508,"_stem":509,"_extension":20},"/python-how-to/handle-api-requests","Handle API Requests","Learn to fetch and process data from web APIs using Python's urllib and external requests library","handle-api-requests",54,"content:python-how-to:54.handle-api-requests.md","python-how-to/54.handle-api-requests.md","python-how-to/54.handle-api-requests",{"_path":511,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":512,"description":513,"slug":514,"parentId":473,"order":515,"_type":15,"_id":516,"_source":17,"_file":517,"_stem":518,"_extension":20},"/python-how-to/work-databases","Work with Databases","Learn to connect to and query SQL databases using Python's sqlite3 and database techniques","work-databases",55,"content:python-how-to:55.work-databases.md","python-how-to/55.work-databases.md","python-how-to/55.work-databases",{"_path":520,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":521,"description":522,"slug":523,"parentId":473,"order":524,"_type":15,"_id":525,"_source":17,"_file":526,"_stem":527,"_extension":20},"/python-how-to/process-large-files","Process Large Files","Learn memory-efficient techniques for handling large files and datasets in Python","process-large-files",56,"content:python-how-to:56.process-large-files.md","python-how-to/56.process-large-files.md","python-how-to/56.process-large-files",{"_path":529,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":530,"description":531,"slug":532,"parentId":290,"order":533,"isParent":13,"icon":534,"_type":15,"_id":535,"_source":17,"_file":536,"_stem":537,"_extension":20,"children":538},"/python-how-to/best-practices","Best Practices","Learn Python best practices for writing clean, maintainable, and efficient code","best-practices",57,"pi pi-star","content:python-how-to:57.best-practices.md","python-how-to/57.best-practices.md","python-how-to/57.best-practices",[539,548,557,566,575,584],{"_path":540,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":541,"description":542,"slug":543,"parentId":529,"order":544,"_type":15,"_id":545,"_source":17,"_file":546,"_stem":547,"_extension":20},"/python-how-to/structure-code","Structure Your Code","Learn to organize Python code with proper module structure, functions, and classes","structure-code",58,"content:python-how-to:58.structure-code.md","python-how-to/58.structure-code.md","python-how-to/58.structure-code",{"_path":549,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":550,"description":551,"slug":552,"parentId":529,"order":553,"_type":15,"_id":554,"_source":17,"_file":555,"_stem":556,"_extension":20},"/python-how-to/write-clean-code","Write Clean Code","Learn to write readable, maintainable Python code with proper naming, comments, and clear logic","write-clean-code",59,"content:python-how-to:59.write-clean-code.md","python-how-to/59.write-clean-code.md","python-how-to/59.write-clean-code",{"_path":558,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":559,"description":560,"slug":561,"parentId":529,"order":562,"_type":15,"_id":563,"_source":17,"_file":564,"_stem":565,"_extension":20},"/python-how-to/optimize-performance","Optimize Performance","Learn to identify and fix performance bottlenecks in Python code for faster execution","optimize-performance",60,"content:python-how-to:60.optimize-performance.md","python-how-to/60.optimize-performance.md","python-how-to/60.optimize-performance",{"_path":567,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":568,"description":569,"slug":570,"parentId":529,"order":571,"_type":15,"_id":572,"_source":17,"_file":573,"_stem":574,"_extension":20},"/python-how-to/write-unit-tests","Write Unit Tests","Learn to create reliable unit tests to verify your Python code works correctly and catch bugs early","write-unit-tests",61,"content:python-how-to:61.write-unit-tests.md","python-how-to/61.write-unit-tests.md","python-how-to/61.write-unit-tests",{"_path":576,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":577,"description":578,"slug":579,"parentId":529,"order":580,"_type":15,"_id":581,"_source":17,"_file":582,"_stem":583,"_extension":20},"/python-how-to/document-code","Document Your Code","Learn to write clear documentation and helpful comments for your Python code","document-code",62,"content:python-how-to:62.document-code.md","python-how-to/62.document-code.md","python-how-to/62.document-code",{"_path":585,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":586,"description":587,"slug":588,"parentId":529,"order":589,"_type":15,"_id":590,"_source":17,"_file":591,"_stem":592,"_extension":20},"/python-how-to/use-type-hints","Use Type Hints","Learn to add type annotations to Python code for better clarity, tooling support, and error detection","use-type-hints",63,"content:python-how-to:63.use-type-hints.md","python-how-to/63.use-type-hints.md","python-how-to/63.use-type-hints",{"_path":290,"_dir":8,"_draft":7,"_partial":7,"_locale":8,"title":594,"description":595,"slug":6,"order":596,"icon":14,"_type":15,"_id":597,"_source":17,"_file":598,"_stem":599,"_extension":20,"expanded":13},"Python How-To Guide","Practical Python tutorials for common programming tasks. Learn step-by-step solutions for string manipulation, file operations, data processing, and more with real-world examples.",0,"content:python-how-to:index.md","python-how-to/index.md","python-how-to/index",[362],{"_path":363,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":364,"description":365,"slug":366,"parentId":352,"order":367,"body":602,"_type":15,"_id":368,"_source":17,"_file":369,"_stem":370,"_extension":20},{"type":603,"children":604,"toc":4130},"root",[605,614,620,800,807,812,912,919,1356,1362,1683,1689,1694,1700,1995,2001,2377,2383,2653,2659,2802,2808,2814,3018,3024,3270,3276,3615,3621,3627,3833,3839,3963,3969,4099,4105,4110,4124],{"type":606,"tag":607,"props":608,"children":610},"element","h1",{"id":609},"handling-exceptions",[611],{"type":612,"value":613},"text","🚨 Handling Exceptions",{"type":606,"tag":615,"props":616,"children":617},"p",{},[618],{"type":612,"value":619},"Exception handling with try/except blocks is the foundation of error management in Python. It allows your program to continue running even when errors occur, providing graceful error recovery.",{"type":606,"tag":621,"props":622,"children":623},"code-try",{},[624],{"type":606,"tag":625,"props":626,"children":630},"pre",{"className":627,"code":628,"language":629,"meta":8,"style":8},"language-python shiki shiki-themes github-light github-dark","# Basic try/except\ntry:\n    result = 10 / 0\nexcept ZeroDivisionError:\n    print(\"Cannot divide by zero\")\n    result = 0\n\nprint(f\"Result: {result}\")\n","python",[631],{"type":606,"tag":632,"props":633,"children":634},"code",{"__ignoreMap":8},[635,646,661,690,707,731,746,754],{"type":606,"tag":636,"props":637,"children":639},"span",{"class":638,"line":12},"line",[640],{"type":606,"tag":636,"props":641,"children":643},{"style":642},"--shiki-default:#6A737D;--shiki-app-dark-mode:#6A737D",[644],{"type":612,"value":645},"# Basic try/except\n",{"type":606,"tag":636,"props":647,"children":648},{"class":638,"line":27},[649,655],{"type":606,"tag":636,"props":650,"children":652},{"style":651},"--shiki-default:#D73A49;--shiki-app-dark-mode:#F97583",[653],{"type":612,"value":654},"try",{"type":606,"tag":636,"props":656,"children":658},{"style":657},"--shiki-default:#24292E;--shiki-app-dark-mode:#E1E4E8",[659],{"type":612,"value":660},":\n",{"type":606,"tag":636,"props":662,"children":663},{"class":638,"line":36},[664,669,674,680,685],{"type":606,"tag":636,"props":665,"children":666},{"style":657},[667],{"type":612,"value":668},"    result ",{"type":606,"tag":636,"props":670,"children":671},{"style":651},[672],{"type":612,"value":673},"=",{"type":606,"tag":636,"props":675,"children":677},{"style":676},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[678],{"type":612,"value":679}," 10",{"type":606,"tag":636,"props":681,"children":682},{"style":651},[683],{"type":612,"value":684}," /",{"type":606,"tag":636,"props":686,"children":687},{"style":676},[688],{"type":612,"value":689}," 0\n",{"type":606,"tag":636,"props":691,"children":692},{"class":638,"line":45},[693,698,703],{"type":606,"tag":636,"props":694,"children":695},{"style":651},[696],{"type":612,"value":697},"except",{"type":606,"tag":636,"props":699,"children":700},{"style":676},[701],{"type":612,"value":702}," ZeroDivisionError",{"type":606,"tag":636,"props":704,"children":705},{"style":657},[706],{"type":612,"value":660},{"type":606,"tag":636,"props":708,"children":709},{"class":638,"line":54},[710,715,720,726],{"type":606,"tag":636,"props":711,"children":712},{"style":676},[713],{"type":612,"value":714},"    print",{"type":606,"tag":636,"props":716,"children":717},{"style":657},[718],{"type":612,"value":719},"(",{"type":606,"tag":636,"props":721,"children":723},{"style":722},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[724],{"type":612,"value":725},"\"Cannot divide by zero\"",{"type":606,"tag":636,"props":727,"children":728},{"style":657},[729],{"type":612,"value":730},")\n",{"type":606,"tag":636,"props":732,"children":733},{"class":638,"line":63},[734,738,742],{"type":606,"tag":636,"props":735,"children":736},{"style":657},[737],{"type":612,"value":668},{"type":606,"tag":636,"props":739,"children":740},{"style":651},[741],{"type":612,"value":673},{"type":606,"tag":636,"props":743,"children":744},{"style":676},[745],{"type":612,"value":689},{"type":606,"tag":636,"props":747,"children":748},{"class":638,"line":72},[749],{"type":606,"tag":636,"props":750,"children":751},{"emptyLinePlaceholder":13},[752],{"type":612,"value":753},"\n",{"type":606,"tag":636,"props":755,"children":756},{"class":638,"line":81},[757,762,766,771,776,781,786,791,796],{"type":606,"tag":636,"props":758,"children":759},{"style":676},[760],{"type":612,"value":761},"print",{"type":606,"tag":636,"props":763,"children":764},{"style":657},[765],{"type":612,"value":719},{"type":606,"tag":636,"props":767,"children":768},{"style":651},[769],{"type":612,"value":770},"f",{"type":606,"tag":636,"props":772,"children":773},{"style":722},[774],{"type":612,"value":775},"\"Result: ",{"type":606,"tag":636,"props":777,"children":778},{"style":676},[779],{"type":612,"value":780},"{",{"type":606,"tag":636,"props":782,"children":783},{"style":657},[784],{"type":612,"value":785},"result",{"type":606,"tag":636,"props":787,"children":788},{"style":676},[789],{"type":612,"value":790},"}",{"type":606,"tag":636,"props":792,"children":793},{"style":722},[794],{"type":612,"value":795},"\"",{"type":606,"tag":636,"props":797,"children":798},{"style":657},[799],{"type":612,"value":730},{"type":606,"tag":801,"props":802,"children":804},"h2",{"id":803},"basic-exception-handling",[805],{"type":612,"value":806},"🎯 Basic Exception Handling",{"type":606,"tag":615,"props":808,"children":809},{},[810],{"type":612,"value":811},"The try/except statement catches and handles exceptions.",{"type":606,"tag":813,"props":814,"children":818},"info-box",{"emoji":815,"title":816,"type":817},"🔧","Try/Except Structure","info",[819,828,874,882],{"type":606,"tag":615,"props":820,"children":821},{},[822],{"type":606,"tag":823,"props":824,"children":825},"strong",{},[826],{"type":612,"value":827},"Basic Structure:",{"type":606,"tag":625,"props":829,"children":831},{"className":627,"code":830,"language":629,"meta":8,"style":8},"try:\n    # Code that might raise an exception\nexcept ExceptionType:\n    # Handle the exception\n",[832],{"type":606,"tag":632,"props":833,"children":834},{"__ignoreMap":8},[835,846,854,866],{"type":606,"tag":636,"props":836,"children":837},{"class":638,"line":12},[838,842],{"type":606,"tag":636,"props":839,"children":840},{"style":651},[841],{"type":612,"value":654},{"type":606,"tag":636,"props":843,"children":844},{"style":657},[845],{"type":612,"value":660},{"type":606,"tag":636,"props":847,"children":848},{"class":638,"line":27},[849],{"type":606,"tag":636,"props":850,"children":851},{"style":642},[852],{"type":612,"value":853},"    # Code that might raise an exception\n",{"type":606,"tag":636,"props":855,"children":856},{"class":638,"line":36},[857,861],{"type":606,"tag":636,"props":858,"children":859},{"style":651},[860],{"type":612,"value":697},{"type":606,"tag":636,"props":862,"children":863},{"style":657},[864],{"type":612,"value":865}," ExceptionType:\n",{"type":606,"tag":636,"props":867,"children":868},{"class":638,"line":45},[869],{"type":606,"tag":636,"props":870,"children":871},{"style":642},[872],{"type":612,"value":873},"    # Handle the exception\n",{"type":606,"tag":615,"props":875,"children":876},{},[877],{"type":606,"tag":823,"props":878,"children":879},{},[880],{"type":612,"value":881},"Components:",{"type":606,"tag":883,"props":884,"children":885},"ul",{},[886,897,907],{"type":606,"tag":887,"props":888,"children":889},"li",{},[890,895],{"type":606,"tag":632,"props":891,"children":893},{"className":892},[],[894],{"type":612,"value":654},{"type":612,"value":896},": Block with code that might fail",{"type":606,"tag":887,"props":898,"children":899},{},[900,905],{"type":606,"tag":632,"props":901,"children":903},{"className":902},[],[904],{"type":612,"value":697},{"type":612,"value":906},": Block that handles the exception",{"type":606,"tag":887,"props":908,"children":909},{},[910],{"type":612,"value":911},"Exception gets caught and handled gracefully",{"type":606,"tag":913,"props":914,"children":916},"h3",{"id":915},"simple-exception-handling",[917],{"type":612,"value":918},"Simple Exception Handling",{"type":606,"tag":621,"props":920,"children":921},{},[922],{"type":606,"tag":625,"props":923,"children":925},{"className":627,"code":924,"language":629,"meta":8,"style":8},"# Handle division by zero\ntry:\n    number = 10 / 0\nexcept ZeroDivisionError:\n    print(\"Division by zero error\")\n    number = 0\n\n# Handle invalid conversion\ntry:\n    age = int(\"abc\")\nexcept ValueError:\n    print(\"Invalid number format\")\n    age = 0\n\n# Handle missing dictionary key\ndata = {\"name\": \"Alice\"}\ntry:\n    email = data[\"email\"]\nexcept KeyError:\n    print(\"Email key not found\")\n    email = \"unknown\"\n\nprint(f\"Number: {number}, Age: {age}, Email: {email}\")\n",[926],{"type":606,"tag":632,"props":927,"children":928},{"__ignoreMap":8},[929,937,948,972,987,1007,1022,1029,1037,1049,1079,1095,1115,1130,1137,1145,1182,1193,1220,1236,1256,1272,1279],{"type":606,"tag":636,"props":930,"children":931},{"class":638,"line":12},[932],{"type":606,"tag":636,"props":933,"children":934},{"style":642},[935],{"type":612,"value":936},"# Handle division by zero\n",{"type":606,"tag":636,"props":938,"children":939},{"class":638,"line":27},[940,944],{"type":606,"tag":636,"props":941,"children":942},{"style":651},[943],{"type":612,"value":654},{"type":606,"tag":636,"props":945,"children":946},{"style":657},[947],{"type":612,"value":660},{"type":606,"tag":636,"props":949,"children":950},{"class":638,"line":36},[951,956,960,964,968],{"type":606,"tag":636,"props":952,"children":953},{"style":657},[954],{"type":612,"value":955},"    number ",{"type":606,"tag":636,"props":957,"children":958},{"style":651},[959],{"type":612,"value":673},{"type":606,"tag":636,"props":961,"children":962},{"style":676},[963],{"type":612,"value":679},{"type":606,"tag":636,"props":965,"children":966},{"style":651},[967],{"type":612,"value":684},{"type":606,"tag":636,"props":969,"children":970},{"style":676},[971],{"type":612,"value":689},{"type":606,"tag":636,"props":973,"children":974},{"class":638,"line":45},[975,979,983],{"type":606,"tag":636,"props":976,"children":977},{"style":651},[978],{"type":612,"value":697},{"type":606,"tag":636,"props":980,"children":981},{"style":676},[982],{"type":612,"value":702},{"type":606,"tag":636,"props":984,"children":985},{"style":657},[986],{"type":612,"value":660},{"type":606,"tag":636,"props":988,"children":989},{"class":638,"line":54},[990,994,998,1003],{"type":606,"tag":636,"props":991,"children":992},{"style":676},[993],{"type":612,"value":714},{"type":606,"tag":636,"props":995,"children":996},{"style":657},[997],{"type":612,"value":719},{"type":606,"tag":636,"props":999,"children":1000},{"style":722},[1001],{"type":612,"value":1002},"\"Division by zero error\"",{"type":606,"tag":636,"props":1004,"children":1005},{"style":657},[1006],{"type":612,"value":730},{"type":606,"tag":636,"props":1008,"children":1009},{"class":638,"line":63},[1010,1014,1018],{"type":606,"tag":636,"props":1011,"children":1012},{"style":657},[1013],{"type":612,"value":955},{"type":606,"tag":636,"props":1015,"children":1016},{"style":651},[1017],{"type":612,"value":673},{"type":606,"tag":636,"props":1019,"children":1020},{"style":676},[1021],{"type":612,"value":689},{"type":606,"tag":636,"props":1023,"children":1024},{"class":638,"line":72},[1025],{"type":606,"tag":636,"props":1026,"children":1027},{"emptyLinePlaceholder":13},[1028],{"type":612,"value":753},{"type":606,"tag":636,"props":1030,"children":1031},{"class":638,"line":81},[1032],{"type":606,"tag":636,"props":1033,"children":1034},{"style":642},[1035],{"type":612,"value":1036},"# Handle invalid conversion\n",{"type":606,"tag":636,"props":1038,"children":1040},{"class":638,"line":1039},9,[1041,1045],{"type":606,"tag":636,"props":1042,"children":1043},{"style":651},[1044],{"type":612,"value":654},{"type":606,"tag":636,"props":1046,"children":1047},{"style":657},[1048],{"type":612,"value":660},{"type":606,"tag":636,"props":1050,"children":1051},{"class":638,"line":99},[1052,1057,1061,1066,1070,1075],{"type":606,"tag":636,"props":1053,"children":1054},{"style":657},[1055],{"type":612,"value":1056},"    age ",{"type":606,"tag":636,"props":1058,"children":1059},{"style":651},[1060],{"type":612,"value":673},{"type":606,"tag":636,"props":1062,"children":1063},{"style":676},[1064],{"type":612,"value":1065}," int",{"type":606,"tag":636,"props":1067,"children":1068},{"style":657},[1069],{"type":612,"value":719},{"type":606,"tag":636,"props":1071,"children":1072},{"style":722},[1073],{"type":612,"value":1074},"\"abc\"",{"type":606,"tag":636,"props":1076,"children":1077},{"style":657},[1078],{"type":612,"value":730},{"type":606,"tag":636,"props":1080,"children":1081},{"class":638,"line":108},[1082,1086,1091],{"type":606,"tag":636,"props":1083,"children":1084},{"style":651},[1085],{"type":612,"value":697},{"type":606,"tag":636,"props":1087,"children":1088},{"style":676},[1089],{"type":612,"value":1090}," ValueError",{"type":606,"tag":636,"props":1092,"children":1093},{"style":657},[1094],{"type":612,"value":660},{"type":606,"tag":636,"props":1096,"children":1097},{"class":638,"line":117},[1098,1102,1106,1111],{"type":606,"tag":636,"props":1099,"children":1100},{"style":676},[1101],{"type":612,"value":714},{"type":606,"tag":636,"props":1103,"children":1104},{"style":657},[1105],{"type":612,"value":719},{"type":606,"tag":636,"props":1107,"children":1108},{"style":722},[1109],{"type":612,"value":1110},"\"Invalid number format\"",{"type":606,"tag":636,"props":1112,"children":1113},{"style":657},[1114],{"type":612,"value":730},{"type":606,"tag":636,"props":1116,"children":1117},{"class":638,"line":126},[1118,1122,1126],{"type":606,"tag":636,"props":1119,"children":1120},{"style":657},[1121],{"type":612,"value":1056},{"type":606,"tag":636,"props":1123,"children":1124},{"style":651},[1125],{"type":612,"value":673},{"type":606,"tag":636,"props":1127,"children":1128},{"style":676},[1129],{"type":612,"value":689},{"type":606,"tag":636,"props":1131,"children":1132},{"class":638,"line":135},[1133],{"type":606,"tag":636,"props":1134,"children":1135},{"emptyLinePlaceholder":13},[1136],{"type":612,"value":753},{"type":606,"tag":636,"props":1138,"children":1139},{"class":638,"line":144},[1140],{"type":606,"tag":636,"props":1141,"children":1142},{"style":642},[1143],{"type":612,"value":1144},"# Handle missing dictionary key\n",{"type":606,"tag":636,"props":1146,"children":1147},{"class":638,"line":153},[1148,1153,1157,1162,1167,1172,1177],{"type":606,"tag":636,"props":1149,"children":1150},{"style":657},[1151],{"type":612,"value":1152},"data ",{"type":606,"tag":636,"props":1154,"children":1155},{"style":651},[1156],{"type":612,"value":673},{"type":606,"tag":636,"props":1158,"children":1159},{"style":657},[1160],{"type":612,"value":1161}," {",{"type":606,"tag":636,"props":1163,"children":1164},{"style":722},[1165],{"type":612,"value":1166},"\"name\"",{"type":606,"tag":636,"props":1168,"children":1169},{"style":657},[1170],{"type":612,"value":1171},": ",{"type":606,"tag":636,"props":1173,"children":1174},{"style":722},[1175],{"type":612,"value":1176},"\"Alice\"",{"type":606,"tag":636,"props":1178,"children":1179},{"style":657},[1180],{"type":612,"value":1181},"}\n",{"type":606,"tag":636,"props":1183,"children":1184},{"class":638,"line":163},[1185,1189],{"type":606,"tag":636,"props":1186,"children":1187},{"style":651},[1188],{"type":612,"value":654},{"type":606,"tag":636,"props":1190,"children":1191},{"style":657},[1192],{"type":612,"value":660},{"type":606,"tag":636,"props":1194,"children":1195},{"class":638,"line":172},[1196,1201,1205,1210,1215],{"type":606,"tag":636,"props":1197,"children":1198},{"style":657},[1199],{"type":612,"value":1200},"    email ",{"type":606,"tag":636,"props":1202,"children":1203},{"style":651},[1204],{"type":612,"value":673},{"type":606,"tag":636,"props":1206,"children":1207},{"style":657},[1208],{"type":612,"value":1209}," data[",{"type":606,"tag":636,"props":1211,"children":1212},{"style":722},[1213],{"type":612,"value":1214},"\"email\"",{"type":606,"tag":636,"props":1216,"children":1217},{"style":657},[1218],{"type":612,"value":1219},"]\n",{"type":606,"tag":636,"props":1221,"children":1222},{"class":638,"line":181},[1223,1227,1232],{"type":606,"tag":636,"props":1224,"children":1225},{"style":651},[1226],{"type":612,"value":697},{"type":606,"tag":636,"props":1228,"children":1229},{"style":676},[1230],{"type":612,"value":1231}," KeyError",{"type":606,"tag":636,"props":1233,"children":1234},{"style":657},[1235],{"type":612,"value":660},{"type":606,"tag":636,"props":1237,"children":1238},{"class":638,"line":190},[1239,1243,1247,1252],{"type":606,"tag":636,"props":1240,"children":1241},{"style":676},[1242],{"type":612,"value":714},{"type":606,"tag":636,"props":1244,"children":1245},{"style":657},[1246],{"type":612,"value":719},{"type":606,"tag":636,"props":1248,"children":1249},{"style":722},[1250],{"type":612,"value":1251},"\"Email key not found\"",{"type":606,"tag":636,"props":1253,"children":1254},{"style":657},[1255],{"type":612,"value":730},{"type":606,"tag":636,"props":1257,"children":1258},{"class":638,"line":199},[1259,1263,1267],{"type":606,"tag":636,"props":1260,"children":1261},{"style":657},[1262],{"type":612,"value":1200},{"type":606,"tag":636,"props":1264,"children":1265},{"style":651},[1266],{"type":612,"value":673},{"type":606,"tag":636,"props":1268,"children":1269},{"style":722},[1270],{"type":612,"value":1271}," \"unknown\"\n",{"type":606,"tag":636,"props":1273,"children":1274},{"class":638,"line":208},[1275],{"type":606,"tag":636,"props":1276,"children":1277},{"emptyLinePlaceholder":13},[1278],{"type":612,"value":753},{"type":606,"tag":636,"props":1280,"children":1281},{"class":638,"line":217},[1282,1286,1290,1294,1299,1303,1308,1312,1317,1321,1326,1330,1335,1339,1344,1348,1352],{"type":606,"tag":636,"props":1283,"children":1284},{"style":676},[1285],{"type":612,"value":761},{"type":606,"tag":636,"props":1287,"children":1288},{"style":657},[1289],{"type":612,"value":719},{"type":606,"tag":636,"props":1291,"children":1292},{"style":651},[1293],{"type":612,"value":770},{"type":606,"tag":636,"props":1295,"children":1296},{"style":722},[1297],{"type":612,"value":1298},"\"Number: ",{"type":606,"tag":636,"props":1300,"children":1301},{"style":676},[1302],{"type":612,"value":780},{"type":606,"tag":636,"props":1304,"children":1305},{"style":657},[1306],{"type":612,"value":1307},"number",{"type":606,"tag":636,"props":1309,"children":1310},{"style":676},[1311],{"type":612,"value":790},{"type":606,"tag":636,"props":1313,"children":1314},{"style":722},[1315],{"type":612,"value":1316},", Age: ",{"type":606,"tag":636,"props":1318,"children":1319},{"style":676},[1320],{"type":612,"value":780},{"type":606,"tag":636,"props":1322,"children":1323},{"style":657},[1324],{"type":612,"value":1325},"age",{"type":606,"tag":636,"props":1327,"children":1328},{"style":676},[1329],{"type":612,"value":790},{"type":606,"tag":636,"props":1331,"children":1332},{"style":722},[1333],{"type":612,"value":1334},", Email: ",{"type":606,"tag":636,"props":1336,"children":1337},{"style":676},[1338],{"type":612,"value":780},{"type":606,"tag":636,"props":1340,"children":1341},{"style":657},[1342],{"type":612,"value":1343},"email",{"type":606,"tag":636,"props":1345,"children":1346},{"style":676},[1347],{"type":612,"value":790},{"type":606,"tag":636,"props":1349,"children":1350},{"style":722},[1351],{"type":612,"value":795},{"type":606,"tag":636,"props":1353,"children":1354},{"style":657},[1355],{"type":612,"value":730},{"type":606,"tag":913,"props":1357,"children":1359},{"id":1358},"getting-exception-information",[1360],{"type":612,"value":1361},"Getting Exception Information",{"type":606,"tag":621,"props":1363,"children":1364},{},[1365],{"type":606,"tag":625,"props":1366,"children":1368},{"className":627,"code":1367,"language":629,"meta":8,"style":8},"# Capture exception details\ntry:\n    result = int(\"invalid\")\nexcept ValueError as e:\n    print(f\"Error occurred: {e}\")\n    print(f\"Error type: {type(e).__name__}\")\n\n# Multiple ways to get error info\ntry:\n    missing_file = open(\"nonexistent.txt\")\nexcept FileNotFoundError as error:\n    print(f\"File error: {error}\")\n    print(f\"Error args: {error.args}\")\n",[1369],{"type":606,"tag":632,"props":1370,"children":1371},{"__ignoreMap":8},[1372,1380,1391,1419,1440,1481,1524,1531,1539,1550,1580,1601,1642],{"type":606,"tag":636,"props":1373,"children":1374},{"class":638,"line":12},[1375],{"type":606,"tag":636,"props":1376,"children":1377},{"style":642},[1378],{"type":612,"value":1379},"# Capture exception details\n",{"type":606,"tag":636,"props":1381,"children":1382},{"class":638,"line":27},[1383,1387],{"type":606,"tag":636,"props":1384,"children":1385},{"style":651},[1386],{"type":612,"value":654},{"type":606,"tag":636,"props":1388,"children":1389},{"style":657},[1390],{"type":612,"value":660},{"type":606,"tag":636,"props":1392,"children":1393},{"class":638,"line":36},[1394,1398,1402,1406,1410,1415],{"type":606,"tag":636,"props":1395,"children":1396},{"style":657},[1397],{"type":612,"value":668},{"type":606,"tag":636,"props":1399,"children":1400},{"style":651},[1401],{"type":612,"value":673},{"type":606,"tag":636,"props":1403,"children":1404},{"style":676},[1405],{"type":612,"value":1065},{"type":606,"tag":636,"props":1407,"children":1408},{"style":657},[1409],{"type":612,"value":719},{"type":606,"tag":636,"props":1411,"children":1412},{"style":722},[1413],{"type":612,"value":1414},"\"invalid\"",{"type":606,"tag":636,"props":1416,"children":1417},{"style":657},[1418],{"type":612,"value":730},{"type":606,"tag":636,"props":1420,"children":1421},{"class":638,"line":45},[1422,1426,1430,1435],{"type":606,"tag":636,"props":1423,"children":1424},{"style":651},[1425],{"type":612,"value":697},{"type":606,"tag":636,"props":1427,"children":1428},{"style":676},[1429],{"type":612,"value":1090},{"type":606,"tag":636,"props":1431,"children":1432},{"style":651},[1433],{"type":612,"value":1434}," as",{"type":606,"tag":636,"props":1436,"children":1437},{"style":657},[1438],{"type":612,"value":1439}," e:\n",{"type":606,"tag":636,"props":1441,"children":1442},{"class":638,"line":54},[1443,1447,1451,1455,1460,1464,1469,1473,1477],{"type":606,"tag":636,"props":1444,"children":1445},{"style":676},[1446],{"type":612,"value":714},{"type":606,"tag":636,"props":1448,"children":1449},{"style":657},[1450],{"type":612,"value":719},{"type":606,"tag":636,"props":1452,"children":1453},{"style":651},[1454],{"type":612,"value":770},{"type":606,"tag":636,"props":1456,"children":1457},{"style":722},[1458],{"type":612,"value":1459},"\"Error occurred: ",{"type":606,"tag":636,"props":1461,"children":1462},{"style":676},[1463],{"type":612,"value":780},{"type":606,"tag":636,"props":1465,"children":1466},{"style":657},[1467],{"type":612,"value":1468},"e",{"type":606,"tag":636,"props":1470,"children":1471},{"style":676},[1472],{"type":612,"value":790},{"type":606,"tag":636,"props":1474,"children":1475},{"style":722},[1476],{"type":612,"value":795},{"type":606,"tag":636,"props":1478,"children":1479},{"style":657},[1480],{"type":612,"value":730},{"type":606,"tag":636,"props":1482,"children":1483},{"class":638,"line":63},[1484,1488,1492,1496,1501,1506,1511,1516,1520],{"type":606,"tag":636,"props":1485,"children":1486},{"style":676},[1487],{"type":612,"value":714},{"type":606,"tag":636,"props":1489,"children":1490},{"style":657},[1491],{"type":612,"value":719},{"type":606,"tag":636,"props":1493,"children":1494},{"style":651},[1495],{"type":612,"value":770},{"type":606,"tag":636,"props":1497,"children":1498},{"style":722},[1499],{"type":612,"value":1500},"\"Error type: ",{"type":606,"tag":636,"props":1502,"children":1503},{"style":676},[1504],{"type":612,"value":1505},"{type",{"type":606,"tag":636,"props":1507,"children":1508},{"style":657},[1509],{"type":612,"value":1510},"(e).",{"type":606,"tag":636,"props":1512,"children":1513},{"style":676},[1514],{"type":612,"value":1515},"__name__}",{"type":606,"tag":636,"props":1517,"children":1518},{"style":722},[1519],{"type":612,"value":795},{"type":606,"tag":636,"props":1521,"children":1522},{"style":657},[1523],{"type":612,"value":730},{"type":606,"tag":636,"props":1525,"children":1526},{"class":638,"line":72},[1527],{"type":606,"tag":636,"props":1528,"children":1529},{"emptyLinePlaceholder":13},[1530],{"type":612,"value":753},{"type":606,"tag":636,"props":1532,"children":1533},{"class":638,"line":81},[1534],{"type":606,"tag":636,"props":1535,"children":1536},{"style":642},[1537],{"type":612,"value":1538},"# Multiple ways to get error info\n",{"type":606,"tag":636,"props":1540,"children":1541},{"class":638,"line":1039},[1542,1546],{"type":606,"tag":636,"props":1543,"children":1544},{"style":651},[1545],{"type":612,"value":654},{"type":606,"tag":636,"props":1547,"children":1548},{"style":657},[1549],{"type":612,"value":660},{"type":606,"tag":636,"props":1551,"children":1552},{"class":638,"line":99},[1553,1558,1562,1567,1571,1576],{"type":606,"tag":636,"props":1554,"children":1555},{"style":657},[1556],{"type":612,"value":1557},"    missing_file ",{"type":606,"tag":636,"props":1559,"children":1560},{"style":651},[1561],{"type":612,"value":673},{"type":606,"tag":636,"props":1563,"children":1564},{"style":676},[1565],{"type":612,"value":1566}," open",{"type":606,"tag":636,"props":1568,"children":1569},{"style":657},[1570],{"type":612,"value":719},{"type":606,"tag":636,"props":1572,"children":1573},{"style":722},[1574],{"type":612,"value":1575},"\"nonexistent.txt\"",{"type":606,"tag":636,"props":1577,"children":1578},{"style":657},[1579],{"type":612,"value":730},{"type":606,"tag":636,"props":1581,"children":1582},{"class":638,"line":108},[1583,1587,1592,1596],{"type":606,"tag":636,"props":1584,"children":1585},{"style":651},[1586],{"type":612,"value":697},{"type":606,"tag":636,"props":1588,"children":1589},{"style":676},[1590],{"type":612,"value":1591}," FileNotFoundError",{"type":606,"tag":636,"props":1593,"children":1594},{"style":651},[1595],{"type":612,"value":1434},{"type":606,"tag":636,"props":1597,"children":1598},{"style":657},[1599],{"type":612,"value":1600}," error:\n",{"type":606,"tag":636,"props":1602,"children":1603},{"class":638,"line":117},[1604,1608,1612,1616,1621,1625,1630,1634,1638],{"type":606,"tag":636,"props":1605,"children":1606},{"style":676},[1607],{"type":612,"value":714},{"type":606,"tag":636,"props":1609,"children":1610},{"style":657},[1611],{"type":612,"value":719},{"type":606,"tag":636,"props":1613,"children":1614},{"style":651},[1615],{"type":612,"value":770},{"type":606,"tag":636,"props":1617,"children":1618},{"style":722},[1619],{"type":612,"value":1620},"\"File error: ",{"type":606,"tag":636,"props":1622,"children":1623},{"style":676},[1624],{"type":612,"value":780},{"type":606,"tag":636,"props":1626,"children":1627},{"style":657},[1628],{"type":612,"value":1629},"error",{"type":606,"tag":636,"props":1631,"children":1632},{"style":676},[1633],{"type":612,"value":790},{"type":606,"tag":636,"props":1635,"children":1636},{"style":722},[1637],{"type":612,"value":795},{"type":606,"tag":636,"props":1639,"children":1640},{"style":657},[1641],{"type":612,"value":730},{"type":606,"tag":636,"props":1643,"children":1644},{"class":638,"line":126},[1645,1649,1653,1657,1662,1666,1671,1675,1679],{"type":606,"tag":636,"props":1646,"children":1647},{"style":676},[1648],{"type":612,"value":714},{"type":606,"tag":636,"props":1650,"children":1651},{"style":657},[1652],{"type":612,"value":719},{"type":606,"tag":636,"props":1654,"children":1655},{"style":651},[1656],{"type":612,"value":770},{"type":606,"tag":636,"props":1658,"children":1659},{"style":722},[1660],{"type":612,"value":1661},"\"Error args: ",{"type":606,"tag":636,"props":1663,"children":1664},{"style":676},[1665],{"type":612,"value":780},{"type":606,"tag":636,"props":1667,"children":1668},{"style":657},[1669],{"type":612,"value":1670},"error.args",{"type":606,"tag":636,"props":1672,"children":1673},{"style":676},[1674],{"type":612,"value":790},{"type":606,"tag":636,"props":1676,"children":1677},{"style":722},[1678],{"type":612,"value":795},{"type":606,"tag":636,"props":1680,"children":1681},{"style":657},[1682],{"type":612,"value":730},{"type":606,"tag":801,"props":1684,"children":1686},{"id":1685},"multiple-exception-handling",[1687],{"type":612,"value":1688},"🔄 Multiple Exception Handling",{"type":606,"tag":615,"props":1690,"children":1691},{},[1692],{"type":612,"value":1693},"Handle different types of exceptions with multiple except blocks.",{"type":606,"tag":913,"props":1695,"children":1697},{"id":1696},"multiple-except-blocks",[1698],{"type":612,"value":1699},"Multiple Except Blocks",{"type":606,"tag":621,"props":1701,"children":1702},{},[1703],{"type":606,"tag":625,"props":1704,"children":1706},{"className":627,"code":1705,"language":629,"meta":8,"style":8},"def safe_divide(a, b):\n    try:\n        result = a / b\n        return result\n    except ZeroDivisionError:\n        print(\"Cannot divide by zero\")\n        return 0\n    except TypeError:\n        print(\"Invalid data types for division\")\n        return None\n\n# Test different scenarios\nprint(safe_divide(10, 2))    # Normal division\nprint(safe_divide(10, 0))    # Division by zero\nprint(safe_divide(\"10\", 2))  # Type error\n",[1707],{"type":606,"tag":632,"props":1708,"children":1709},{"__ignoreMap":8},[1710,1729,1741,1768,1781,1797,1817,1828,1844,1864,1876,1883,1891,1928,1961],{"type":606,"tag":636,"props":1711,"children":1712},{"class":638,"line":12},[1713,1718,1724],{"type":606,"tag":636,"props":1714,"children":1715},{"style":651},[1716],{"type":612,"value":1717},"def",{"type":606,"tag":636,"props":1719,"children":1721},{"style":1720},"--shiki-default:#6F42C1;--shiki-app-dark-mode:#B392F0",[1722],{"type":612,"value":1723}," safe_divide",{"type":606,"tag":636,"props":1725,"children":1726},{"style":657},[1727],{"type":612,"value":1728},"(a, b):\n",{"type":606,"tag":636,"props":1730,"children":1731},{"class":638,"line":27},[1732,1737],{"type":606,"tag":636,"props":1733,"children":1734},{"style":651},[1735],{"type":612,"value":1736},"    try",{"type":606,"tag":636,"props":1738,"children":1739},{"style":657},[1740],{"type":612,"value":660},{"type":606,"tag":636,"props":1742,"children":1743},{"class":638,"line":36},[1744,1749,1753,1758,1763],{"type":606,"tag":636,"props":1745,"children":1746},{"style":657},[1747],{"type":612,"value":1748},"        result ",{"type":606,"tag":636,"props":1750,"children":1751},{"style":651},[1752],{"type":612,"value":673},{"type":606,"tag":636,"props":1754,"children":1755},{"style":657},[1756],{"type":612,"value":1757}," a ",{"type":606,"tag":636,"props":1759,"children":1760},{"style":651},[1761],{"type":612,"value":1762},"/",{"type":606,"tag":636,"props":1764,"children":1765},{"style":657},[1766],{"type":612,"value":1767}," b\n",{"type":606,"tag":636,"props":1769,"children":1770},{"class":638,"line":45},[1771,1776],{"type":606,"tag":636,"props":1772,"children":1773},{"style":651},[1774],{"type":612,"value":1775},"        return",{"type":606,"tag":636,"props":1777,"children":1778},{"style":657},[1779],{"type":612,"value":1780}," result\n",{"type":606,"tag":636,"props":1782,"children":1783},{"class":638,"line":54},[1784,1789,1793],{"type":606,"tag":636,"props":1785,"children":1786},{"style":651},[1787],{"type":612,"value":1788},"    except",{"type":606,"tag":636,"props":1790,"children":1791},{"style":676},[1792],{"type":612,"value":702},{"type":606,"tag":636,"props":1794,"children":1795},{"style":657},[1796],{"type":612,"value":660},{"type":606,"tag":636,"props":1798,"children":1799},{"class":638,"line":63},[1800,1805,1809,1813],{"type":606,"tag":636,"props":1801,"children":1802},{"style":676},[1803],{"type":612,"value":1804},"        print",{"type":606,"tag":636,"props":1806,"children":1807},{"style":657},[1808],{"type":612,"value":719},{"type":606,"tag":636,"props":1810,"children":1811},{"style":722},[1812],{"type":612,"value":725},{"type":606,"tag":636,"props":1814,"children":1815},{"style":657},[1816],{"type":612,"value":730},{"type":606,"tag":636,"props":1818,"children":1819},{"class":638,"line":72},[1820,1824],{"type":606,"tag":636,"props":1821,"children":1822},{"style":651},[1823],{"type":612,"value":1775},{"type":606,"tag":636,"props":1825,"children":1826},{"style":676},[1827],{"type":612,"value":689},{"type":606,"tag":636,"props":1829,"children":1830},{"class":638,"line":81},[1831,1835,1840],{"type":606,"tag":636,"props":1832,"children":1833},{"style":651},[1834],{"type":612,"value":1788},{"type":606,"tag":636,"props":1836,"children":1837},{"style":676},[1838],{"type":612,"value":1839}," TypeError",{"type":606,"tag":636,"props":1841,"children":1842},{"style":657},[1843],{"type":612,"value":660},{"type":606,"tag":636,"props":1845,"children":1846},{"class":638,"line":1039},[1847,1851,1855,1860],{"type":606,"tag":636,"props":1848,"children":1849},{"style":676},[1850],{"type":612,"value":1804},{"type":606,"tag":636,"props":1852,"children":1853},{"style":657},[1854],{"type":612,"value":719},{"type":606,"tag":636,"props":1856,"children":1857},{"style":722},[1858],{"type":612,"value":1859},"\"Invalid data types for division\"",{"type":606,"tag":636,"props":1861,"children":1862},{"style":657},[1863],{"type":612,"value":730},{"type":606,"tag":636,"props":1865,"children":1866},{"class":638,"line":99},[1867,1871],{"type":606,"tag":636,"props":1868,"children":1869},{"style":651},[1870],{"type":612,"value":1775},{"type":606,"tag":636,"props":1872,"children":1873},{"style":676},[1874],{"type":612,"value":1875}," None\n",{"type":606,"tag":636,"props":1877,"children":1878},{"class":638,"line":108},[1879],{"type":606,"tag":636,"props":1880,"children":1881},{"emptyLinePlaceholder":13},[1882],{"type":612,"value":753},{"type":606,"tag":636,"props":1884,"children":1885},{"class":638,"line":117},[1886],{"type":606,"tag":636,"props":1887,"children":1888},{"style":642},[1889],{"type":612,"value":1890},"# Test different scenarios\n",{"type":606,"tag":636,"props":1892,"children":1893},{"class":638,"line":126},[1894,1898,1903,1908,1913,1918,1923],{"type":606,"tag":636,"props":1895,"children":1896},{"style":676},[1897],{"type":612,"value":761},{"type":606,"tag":636,"props":1899,"children":1900},{"style":657},[1901],{"type":612,"value":1902},"(safe_divide(",{"type":606,"tag":636,"props":1904,"children":1905},{"style":676},[1906],{"type":612,"value":1907},"10",{"type":606,"tag":636,"props":1909,"children":1910},{"style":657},[1911],{"type":612,"value":1912},", ",{"type":606,"tag":636,"props":1914,"children":1915},{"style":676},[1916],{"type":612,"value":1917},"2",{"type":606,"tag":636,"props":1919,"children":1920},{"style":657},[1921],{"type":612,"value":1922},"))    ",{"type":606,"tag":636,"props":1924,"children":1925},{"style":642},[1926],{"type":612,"value":1927},"# Normal division\n",{"type":606,"tag":636,"props":1929,"children":1930},{"class":638,"line":135},[1931,1935,1939,1943,1947,1952,1956],{"type":606,"tag":636,"props":1932,"children":1933},{"style":676},[1934],{"type":612,"value":761},{"type":606,"tag":636,"props":1936,"children":1937},{"style":657},[1938],{"type":612,"value":1902},{"type":606,"tag":636,"props":1940,"children":1941},{"style":676},[1942],{"type":612,"value":1907},{"type":606,"tag":636,"props":1944,"children":1945},{"style":657},[1946],{"type":612,"value":1912},{"type":606,"tag":636,"props":1948,"children":1949},{"style":676},[1950],{"type":612,"value":1951},"0",{"type":606,"tag":636,"props":1953,"children":1954},{"style":657},[1955],{"type":612,"value":1922},{"type":606,"tag":636,"props":1957,"children":1958},{"style":642},[1959],{"type":612,"value":1960},"# Division by zero\n",{"type":606,"tag":636,"props":1962,"children":1963},{"class":638,"line":144},[1964,1968,1972,1977,1981,1985,1990],{"type":606,"tag":636,"props":1965,"children":1966},{"style":676},[1967],{"type":612,"value":761},{"type":606,"tag":636,"props":1969,"children":1970},{"style":657},[1971],{"type":612,"value":1902},{"type":606,"tag":636,"props":1973,"children":1974},{"style":722},[1975],{"type":612,"value":1976},"\"10\"",{"type":606,"tag":636,"props":1978,"children":1979},{"style":657},[1980],{"type":612,"value":1912},{"type":606,"tag":636,"props":1982,"children":1983},{"style":676},[1984],{"type":612,"value":1917},{"type":606,"tag":636,"props":1986,"children":1987},{"style":657},[1988],{"type":612,"value":1989},"))  ",{"type":606,"tag":636,"props":1991,"children":1992},{"style":642},[1993],{"type":612,"value":1994},"# Type error\n",{"type":606,"tag":913,"props":1996,"children":1998},{"id":1997},"catching-multiple-exception-types",[1999],{"type":612,"value":2000},"Catching Multiple Exception Types",{"type":606,"tag":621,"props":2002,"children":2003},{},[2004],{"type":606,"tag":625,"props":2005,"children":2007},{"className":627,"code":2006,"language":629,"meta":8,"style":8},"# Handle multiple exceptions in one block\ntry:\n    data = {\"count\": \"5\"}\n    result = 10 / int(data[\"count\"])\nexcept (ValueError, TypeError, KeyError) as e:\n    print(f\"Data processing error: {e}\")\n    result = 0\n\n# Handle any exception\ntry:\n    risky_operation = 1 / 0\nexcept Exception as e:\n    print(f\"Unexpected error: {e}\")\n    risky_operation = None\n\nprint(f\"Result: {result}\")\n",[2008],{"type":606,"tag":632,"props":2009,"children":2010},{"__ignoreMap":8},[2011,2019,2030,2064,2101,2150,2190,2205,2212,2220,2231,2256,2276,2316,2331,2338],{"type":606,"tag":636,"props":2012,"children":2013},{"class":638,"line":12},[2014],{"type":606,"tag":636,"props":2015,"children":2016},{"style":642},[2017],{"type":612,"value":2018},"# Handle multiple exceptions in one block\n",{"type":606,"tag":636,"props":2020,"children":2021},{"class":638,"line":27},[2022,2026],{"type":606,"tag":636,"props":2023,"children":2024},{"style":651},[2025],{"type":612,"value":654},{"type":606,"tag":636,"props":2027,"children":2028},{"style":657},[2029],{"type":612,"value":660},{"type":606,"tag":636,"props":2031,"children":2032},{"class":638,"line":36},[2033,2038,2042,2046,2051,2055,2060],{"type":606,"tag":636,"props":2034,"children":2035},{"style":657},[2036],{"type":612,"value":2037},"    data ",{"type":606,"tag":636,"props":2039,"children":2040},{"style":651},[2041],{"type":612,"value":673},{"type":606,"tag":636,"props":2043,"children":2044},{"style":657},[2045],{"type":612,"value":1161},{"type":606,"tag":636,"props":2047,"children":2048},{"style":722},[2049],{"type":612,"value":2050},"\"count\"",{"type":606,"tag":636,"props":2052,"children":2053},{"style":657},[2054],{"type":612,"value":1171},{"type":606,"tag":636,"props":2056,"children":2057},{"style":722},[2058],{"type":612,"value":2059},"\"5\"",{"type":606,"tag":636,"props":2061,"children":2062},{"style":657},[2063],{"type":612,"value":1181},{"type":606,"tag":636,"props":2065,"children":2066},{"class":638,"line":45},[2067,2071,2075,2079,2083,2087,2092,2096],{"type":606,"tag":636,"props":2068,"children":2069},{"style":657},[2070],{"type":612,"value":668},{"type":606,"tag":636,"props":2072,"children":2073},{"style":651},[2074],{"type":612,"value":673},{"type":606,"tag":636,"props":2076,"children":2077},{"style":676},[2078],{"type":612,"value":679},{"type":606,"tag":636,"props":2080,"children":2081},{"style":651},[2082],{"type":612,"value":684},{"type":606,"tag":636,"props":2084,"children":2085},{"style":676},[2086],{"type":612,"value":1065},{"type":606,"tag":636,"props":2088,"children":2089},{"style":657},[2090],{"type":612,"value":2091},"(data[",{"type":606,"tag":636,"props":2093,"children":2094},{"style":722},[2095],{"type":612,"value":2050},{"type":606,"tag":636,"props":2097,"children":2098},{"style":657},[2099],{"type":612,"value":2100},"])\n",{"type":606,"tag":636,"props":2102,"children":2103},{"class":638,"line":54},[2104,2108,2113,2118,2122,2127,2131,2136,2141,2146],{"type":606,"tag":636,"props":2105,"children":2106},{"style":651},[2107],{"type":612,"value":697},{"type":606,"tag":636,"props":2109,"children":2110},{"style":657},[2111],{"type":612,"value":2112}," (",{"type":606,"tag":636,"props":2114,"children":2115},{"style":676},[2116],{"type":612,"value":2117},"ValueError",{"type":606,"tag":636,"props":2119,"children":2120},{"style":657},[2121],{"type":612,"value":1912},{"type":606,"tag":636,"props":2123,"children":2124},{"style":676},[2125],{"type":612,"value":2126},"TypeError",{"type":606,"tag":636,"props":2128,"children":2129},{"style":657},[2130],{"type":612,"value":1912},{"type":606,"tag":636,"props":2132,"children":2133},{"style":676},[2134],{"type":612,"value":2135},"KeyError",{"type":606,"tag":636,"props":2137,"children":2138},{"style":657},[2139],{"type":612,"value":2140},") ",{"type":606,"tag":636,"props":2142,"children":2143},{"style":651},[2144],{"type":612,"value":2145},"as",{"type":606,"tag":636,"props":2147,"children":2148},{"style":657},[2149],{"type":612,"value":1439},{"type":606,"tag":636,"props":2151,"children":2152},{"class":638,"line":63},[2153,2157,2161,2165,2170,2174,2178,2182,2186],{"type":606,"tag":636,"props":2154,"children":2155},{"style":676},[2156],{"type":612,"value":714},{"type":606,"tag":636,"props":2158,"children":2159},{"style":657},[2160],{"type":612,"value":719},{"type":606,"tag":636,"props":2162,"children":2163},{"style":651},[2164],{"type":612,"value":770},{"type":606,"tag":636,"props":2166,"children":2167},{"style":722},[2168],{"type":612,"value":2169},"\"Data processing error: ",{"type":606,"tag":636,"props":2171,"children":2172},{"style":676},[2173],{"type":612,"value":780},{"type":606,"tag":636,"props":2175,"children":2176},{"style":657},[2177],{"type":612,"value":1468},{"type":606,"tag":636,"props":2179,"children":2180},{"style":676},[2181],{"type":612,"value":790},{"type":606,"tag":636,"props":2183,"children":2184},{"style":722},[2185],{"type":612,"value":795},{"type":606,"tag":636,"props":2187,"children":2188},{"style":657},[2189],{"type":612,"value":730},{"type":606,"tag":636,"props":2191,"children":2192},{"class":638,"line":72},[2193,2197,2201],{"type":606,"tag":636,"props":2194,"children":2195},{"style":657},[2196],{"type":612,"value":668},{"type":606,"tag":636,"props":2198,"children":2199},{"style":651},[2200],{"type":612,"value":673},{"type":606,"tag":636,"props":2202,"children":2203},{"style":676},[2204],{"type":612,"value":689},{"type":606,"tag":636,"props":2206,"children":2207},{"class":638,"line":81},[2208],{"type":606,"tag":636,"props":2209,"children":2210},{"emptyLinePlaceholder":13},[2211],{"type":612,"value":753},{"type":606,"tag":636,"props":2213,"children":2214},{"class":638,"line":1039},[2215],{"type":606,"tag":636,"props":2216,"children":2217},{"style":642},[2218],{"type":612,"value":2219},"# Handle any exception\n",{"type":606,"tag":636,"props":2221,"children":2222},{"class":638,"line":99},[2223,2227],{"type":606,"tag":636,"props":2224,"children":2225},{"style":651},[2226],{"type":612,"value":654},{"type":606,"tag":636,"props":2228,"children":2229},{"style":657},[2230],{"type":612,"value":660},{"type":606,"tag":636,"props":2232,"children":2233},{"class":638,"line":108},[2234,2239,2243,2248,2252],{"type":606,"tag":636,"props":2235,"children":2236},{"style":657},[2237],{"type":612,"value":2238},"    risky_operation ",{"type":606,"tag":636,"props":2240,"children":2241},{"style":651},[2242],{"type":612,"value":673},{"type":606,"tag":636,"props":2244,"children":2245},{"style":676},[2246],{"type":612,"value":2247}," 1",{"type":606,"tag":636,"props":2249,"children":2250},{"style":651},[2251],{"type":612,"value":684},{"type":606,"tag":636,"props":2253,"children":2254},{"style":676},[2255],{"type":612,"value":689},{"type":606,"tag":636,"props":2257,"children":2258},{"class":638,"line":117},[2259,2263,2268,2272],{"type":606,"tag":636,"props":2260,"children":2261},{"style":651},[2262],{"type":612,"value":697},{"type":606,"tag":636,"props":2264,"children":2265},{"style":676},[2266],{"type":612,"value":2267}," Exception",{"type":606,"tag":636,"props":2269,"children":2270},{"style":651},[2271],{"type":612,"value":1434},{"type":606,"tag":636,"props":2273,"children":2274},{"style":657},[2275],{"type":612,"value":1439},{"type":606,"tag":636,"props":2277,"children":2278},{"class":638,"line":126},[2279,2283,2287,2291,2296,2300,2304,2308,2312],{"type":606,"tag":636,"props":2280,"children":2281},{"style":676},[2282],{"type":612,"value":714},{"type":606,"tag":636,"props":2284,"children":2285},{"style":657},[2286],{"type":612,"value":719},{"type":606,"tag":636,"props":2288,"children":2289},{"style":651},[2290],{"type":612,"value":770},{"type":606,"tag":636,"props":2292,"children":2293},{"style":722},[2294],{"type":612,"value":2295},"\"Unexpected error: ",{"type":606,"tag":636,"props":2297,"children":2298},{"style":676},[2299],{"type":612,"value":780},{"type":606,"tag":636,"props":2301,"children":2302},{"style":657},[2303],{"type":612,"value":1468},{"type":606,"tag":636,"props":2305,"children":2306},{"style":676},[2307],{"type":612,"value":790},{"type":606,"tag":636,"props":2309,"children":2310},{"style":722},[2311],{"type":612,"value":795},{"type":606,"tag":636,"props":2313,"children":2314},{"style":657},[2315],{"type":612,"value":730},{"type":606,"tag":636,"props":2317,"children":2318},{"class":638,"line":135},[2319,2323,2327],{"type":606,"tag":636,"props":2320,"children":2321},{"style":657},[2322],{"type":612,"value":2238},{"type":606,"tag":636,"props":2324,"children":2325},{"style":651},[2326],{"type":612,"value":673},{"type":606,"tag":636,"props":2328,"children":2329},{"style":676},[2330],{"type":612,"value":1875},{"type":606,"tag":636,"props":2332,"children":2333},{"class":638,"line":144},[2334],{"type":606,"tag":636,"props":2335,"children":2336},{"emptyLinePlaceholder":13},[2337],{"type":612,"value":753},{"type":606,"tag":636,"props":2339,"children":2340},{"class":638,"line":153},[2341,2345,2349,2353,2357,2361,2365,2369,2373],{"type":606,"tag":636,"props":2342,"children":2343},{"style":676},[2344],{"type":612,"value":761},{"type":606,"tag":636,"props":2346,"children":2347},{"style":657},[2348],{"type":612,"value":719},{"type":606,"tag":636,"props":2350,"children":2351},{"style":651},[2352],{"type":612,"value":770},{"type":606,"tag":636,"props":2354,"children":2355},{"style":722},[2356],{"type":612,"value":775},{"type":606,"tag":636,"props":2358,"children":2359},{"style":676},[2360],{"type":612,"value":780},{"type":606,"tag":636,"props":2362,"children":2363},{"style":657},[2364],{"type":612,"value":785},{"type":606,"tag":636,"props":2366,"children":2367},{"style":676},[2368],{"type":612,"value":790},{"type":606,"tag":636,"props":2370,"children":2371},{"style":722},[2372],{"type":612,"value":795},{"type":606,"tag":636,"props":2374,"children":2375},{"style":657},[2376],{"type":612,"value":730},{"type":606,"tag":913,"props":2378,"children":2380},{"id":2379},"exception-hierarchy",[2381],{"type":612,"value":2382},"Exception Hierarchy",{"type":606,"tag":621,"props":2384,"children":2385},{},[2386],{"type":606,"tag":625,"props":2387,"children":2389},{"className":627,"code":2388,"language":629,"meta":8,"style":8},"# Catch specific first, then general\ntry:\n    numbers = [1, 2, 3]\n    value = numbers[10]\nexcept IndexError:\n    print(\"Index out of range\")\n    value = 0\nexcept Exception as e:\n    print(f\"Other error: {e}\")\n    value = None\n\nprint(f\"Value: {value}\")\n",[2390],{"type":606,"tag":632,"props":2391,"children":2392},{"__ignoreMap":8},[2393,2401,2412,2455,2480,2496,2516,2531,2550,2590,2605,2612],{"type":606,"tag":636,"props":2394,"children":2395},{"class":638,"line":12},[2396],{"type":606,"tag":636,"props":2397,"children":2398},{"style":642},[2399],{"type":612,"value":2400},"# Catch specific first, then general\n",{"type":606,"tag":636,"props":2402,"children":2403},{"class":638,"line":27},[2404,2408],{"type":606,"tag":636,"props":2405,"children":2406},{"style":651},[2407],{"type":612,"value":654},{"type":606,"tag":636,"props":2409,"children":2410},{"style":657},[2411],{"type":612,"value":660},{"type":606,"tag":636,"props":2413,"children":2414},{"class":638,"line":36},[2415,2420,2424,2429,2434,2438,2442,2446,2451],{"type":606,"tag":636,"props":2416,"children":2417},{"style":657},[2418],{"type":612,"value":2419},"    numbers ",{"type":606,"tag":636,"props":2421,"children":2422},{"style":651},[2423],{"type":612,"value":673},{"type":606,"tag":636,"props":2425,"children":2426},{"style":657},[2427],{"type":612,"value":2428}," [",{"type":606,"tag":636,"props":2430,"children":2431},{"style":676},[2432],{"type":612,"value":2433},"1",{"type":606,"tag":636,"props":2435,"children":2436},{"style":657},[2437],{"type":612,"value":1912},{"type":606,"tag":636,"props":2439,"children":2440},{"style":676},[2441],{"type":612,"value":1917},{"type":606,"tag":636,"props":2443,"children":2444},{"style":657},[2445],{"type":612,"value":1912},{"type":606,"tag":636,"props":2447,"children":2448},{"style":676},[2449],{"type":612,"value":2450},"3",{"type":606,"tag":636,"props":2452,"children":2453},{"style":657},[2454],{"type":612,"value":1219},{"type":606,"tag":636,"props":2456,"children":2457},{"class":638,"line":45},[2458,2463,2467,2472,2476],{"type":606,"tag":636,"props":2459,"children":2460},{"style":657},[2461],{"type":612,"value":2462},"    value ",{"type":606,"tag":636,"props":2464,"children":2465},{"style":651},[2466],{"type":612,"value":673},{"type":606,"tag":636,"props":2468,"children":2469},{"style":657},[2470],{"type":612,"value":2471}," numbers[",{"type":606,"tag":636,"props":2473,"children":2474},{"style":676},[2475],{"type":612,"value":1907},{"type":606,"tag":636,"props":2477,"children":2478},{"style":657},[2479],{"type":612,"value":1219},{"type":606,"tag":636,"props":2481,"children":2482},{"class":638,"line":54},[2483,2487,2492],{"type":606,"tag":636,"props":2484,"children":2485},{"style":651},[2486],{"type":612,"value":697},{"type":606,"tag":636,"props":2488,"children":2489},{"style":676},[2490],{"type":612,"value":2491}," IndexError",{"type":606,"tag":636,"props":2493,"children":2494},{"style":657},[2495],{"type":612,"value":660},{"type":606,"tag":636,"props":2497,"children":2498},{"class":638,"line":63},[2499,2503,2507,2512],{"type":606,"tag":636,"props":2500,"children":2501},{"style":676},[2502],{"type":612,"value":714},{"type":606,"tag":636,"props":2504,"children":2505},{"style":657},[2506],{"type":612,"value":719},{"type":606,"tag":636,"props":2508,"children":2509},{"style":722},[2510],{"type":612,"value":2511},"\"Index out of range\"",{"type":606,"tag":636,"props":2513,"children":2514},{"style":657},[2515],{"type":612,"value":730},{"type":606,"tag":636,"props":2517,"children":2518},{"class":638,"line":72},[2519,2523,2527],{"type":606,"tag":636,"props":2520,"children":2521},{"style":657},[2522],{"type":612,"value":2462},{"type":606,"tag":636,"props":2524,"children":2525},{"style":651},[2526],{"type":612,"value":673},{"type":606,"tag":636,"props":2528,"children":2529},{"style":676},[2530],{"type":612,"value":689},{"type":606,"tag":636,"props":2532,"children":2533},{"class":638,"line":81},[2534,2538,2542,2546],{"type":606,"tag":636,"props":2535,"children":2536},{"style":651},[2537],{"type":612,"value":697},{"type":606,"tag":636,"props":2539,"children":2540},{"style":676},[2541],{"type":612,"value":2267},{"type":606,"tag":636,"props":2543,"children":2544},{"style":651},[2545],{"type":612,"value":1434},{"type":606,"tag":636,"props":2547,"children":2548},{"style":657},[2549],{"type":612,"value":1439},{"type":606,"tag":636,"props":2551,"children":2552},{"class":638,"line":1039},[2553,2557,2561,2565,2570,2574,2578,2582,2586],{"type":606,"tag":636,"props":2554,"children":2555},{"style":676},[2556],{"type":612,"value":714},{"type":606,"tag":636,"props":2558,"children":2559},{"style":657},[2560],{"type":612,"value":719},{"type":606,"tag":636,"props":2562,"children":2563},{"style":651},[2564],{"type":612,"value":770},{"type":606,"tag":636,"props":2566,"children":2567},{"style":722},[2568],{"type":612,"value":2569},"\"Other error: ",{"type":606,"tag":636,"props":2571,"children":2572},{"style":676},[2573],{"type":612,"value":780},{"type":606,"tag":636,"props":2575,"children":2576},{"style":657},[2577],{"type":612,"value":1468},{"type":606,"tag":636,"props":2579,"children":2580},{"style":676},[2581],{"type":612,"value":790},{"type":606,"tag":636,"props":2583,"children":2584},{"style":722},[2585],{"type":612,"value":795},{"type":606,"tag":636,"props":2587,"children":2588},{"style":657},[2589],{"type":612,"value":730},{"type":606,"tag":636,"props":2591,"children":2592},{"class":638,"line":99},[2593,2597,2601],{"type":606,"tag":636,"props":2594,"children":2595},{"style":657},[2596],{"type":612,"value":2462},{"type":606,"tag":636,"props":2598,"children":2599},{"style":651},[2600],{"type":612,"value":673},{"type":606,"tag":636,"props":2602,"children":2603},{"style":676},[2604],{"type":612,"value":1875},{"type":606,"tag":636,"props":2606,"children":2607},{"class":638,"line":108},[2608],{"type":606,"tag":636,"props":2609,"children":2610},{"emptyLinePlaceholder":13},[2611],{"type":612,"value":753},{"type":606,"tag":636,"props":2613,"children":2614},{"class":638,"line":117},[2615,2619,2623,2627,2632,2636,2641,2645,2649],{"type":606,"tag":636,"props":2616,"children":2617},{"style":676},[2618],{"type":612,"value":761},{"type":606,"tag":636,"props":2620,"children":2621},{"style":657},[2622],{"type":612,"value":719},{"type":606,"tag":636,"props":2624,"children":2625},{"style":651},[2626],{"type":612,"value":770},{"type":606,"tag":636,"props":2628,"children":2629},{"style":722},[2630],{"type":612,"value":2631},"\"Value: ",{"type":606,"tag":636,"props":2633,"children":2634},{"style":676},[2635],{"type":612,"value":780},{"type":606,"tag":636,"props":2637,"children":2638},{"style":657},[2639],{"type":612,"value":2640},"value",{"type":606,"tag":636,"props":2642,"children":2643},{"style":676},[2644],{"type":612,"value":790},{"type":606,"tag":636,"props":2646,"children":2647},{"style":722},[2648],{"type":612,"value":795},{"type":606,"tag":636,"props":2650,"children":2651},{"style":657},[2652],{"type":612,"value":730},{"type":606,"tag":801,"props":2654,"children":2656},{"id":2655},"essential-exception-handling-patterns",[2657],{"type":612,"value":2658},"📋 Essential Exception Handling Patterns",{"type":606,"tag":2660,"props":2661,"children":2662},"table",{},[2663,2687],{"type":606,"tag":2664,"props":2665,"children":2666},"thead",{},[2667],{"type":606,"tag":2668,"props":2669,"children":2670},"tr",{},[2671,2677,2682],{"type":606,"tag":2672,"props":2673,"children":2674},"th",{},[2675],{"type":612,"value":2676},"Pattern",{"type":606,"tag":2672,"props":2678,"children":2679},{},[2680],{"type":612,"value":2681},"Syntax",{"type":606,"tag":2672,"props":2683,"children":2684},{},[2685],{"type":612,"value":2686},"Use Case",{"type":606,"tag":2688,"props":2689,"children":2690},"tbody",{},[2691,2714,2736,2758,2780],{"type":606,"tag":2668,"props":2692,"children":2693},{},[2694,2700,2709],{"type":606,"tag":2695,"props":2696,"children":2697},"td",{},[2698],{"type":612,"value":2699},"Basic",{"type":606,"tag":2695,"props":2701,"children":2702},{},[2703],{"type":606,"tag":632,"props":2704,"children":2706},{"className":2705},[],[2707],{"type":612,"value":2708},"except ValueError:",{"type":606,"tag":2695,"props":2710,"children":2711},{},[2712],{"type":612,"value":2713},"Handle specific exception",{"type":606,"tag":2668,"props":2715,"children":2716},{},[2717,2722,2731],{"type":606,"tag":2695,"props":2718,"children":2719},{},[2720],{"type":612,"value":2721},"With info",{"type":606,"tag":2695,"props":2723,"children":2724},{},[2725],{"type":606,"tag":632,"props":2726,"children":2728},{"className":2727},[],[2729],{"type":612,"value":2730},"except ValueError as e:",{"type":606,"tag":2695,"props":2732,"children":2733},{},[2734],{"type":612,"value":2735},"Get exception details",{"type":606,"tag":2668,"props":2737,"children":2738},{},[2739,2744,2753],{"type":606,"tag":2695,"props":2740,"children":2741},{},[2742],{"type":612,"value":2743},"Multiple types",{"type":606,"tag":2695,"props":2745,"children":2746},{},[2747],{"type":606,"tag":632,"props":2748,"children":2750},{"className":2749},[],[2751],{"type":612,"value":2752},"except (ValueError, TypeError):",{"type":606,"tag":2695,"props":2754,"children":2755},{},[2756],{"type":612,"value":2757},"Handle several exceptions",{"type":606,"tag":2668,"props":2759,"children":2760},{},[2761,2766,2775],{"type":606,"tag":2695,"props":2762,"children":2763},{},[2764],{"type":612,"value":2765},"Catch all",{"type":606,"tag":2695,"props":2767,"children":2768},{},[2769],{"type":606,"tag":632,"props":2770,"children":2772},{"className":2771},[],[2773],{"type":612,"value":2774},"except Exception:",{"type":606,"tag":2695,"props":2776,"children":2777},{},[2778],{"type":612,"value":2779},"Handle any exception",{"type":606,"tag":2668,"props":2781,"children":2782},{},[2783,2788,2797],{"type":606,"tag":2695,"props":2784,"children":2785},{},[2786],{"type":612,"value":2787},"Bare except",{"type":606,"tag":2695,"props":2789,"children":2790},{},[2791],{"type":606,"tag":632,"props":2792,"children":2794},{"className":2793},[],[2795],{"type":612,"value":2796},"except:",{"type":606,"tag":2695,"props":2798,"children":2799},{},[2800],{"type":612,"value":2801},"Handle everything (not recommended)",{"type":606,"tag":801,"props":2803,"children":2805},{"id":2804},"finally-and-else-blocks",[2806],{"type":612,"value":2807},"🔧 Finally and Else Blocks",{"type":606,"tag":913,"props":2809,"children":2811},{"id":2810},"finally-block",[2812],{"type":612,"value":2813},"Finally Block",{"type":606,"tag":621,"props":2815,"children":2816},{},[2817],{"type":606,"tag":625,"props":2818,"children":2820},{"className":627,"code":2819,"language":629,"meta":8,"style":8},"# Finally always executes\nfile = None\ntry:\n    file = open(\"data.txt\", \"w\")\n    file.write(\"test data\")\nexcept IOError:\n    print(\"File operation failed\")\nfinally:\n    if file:\n        file.close()\n        print(\"File closed\")\n",[2821],{"type":606,"tag":632,"props":2822,"children":2823},{"__ignoreMap":8},[2824,2832,2850,2861,2899,2920,2936,2956,2968,2985,2998],{"type":606,"tag":636,"props":2825,"children":2826},{"class":638,"line":12},[2827],{"type":606,"tag":636,"props":2828,"children":2829},{"style":642},[2830],{"type":612,"value":2831},"# Finally always executes\n",{"type":606,"tag":636,"props":2833,"children":2834},{"class":638,"line":27},[2835,2841,2846],{"type":606,"tag":636,"props":2836,"children":2838},{"style":2837},"--shiki-default:#E36209;--shiki-app-dark-mode:#FFAB70",[2839],{"type":612,"value":2840},"file",{"type":606,"tag":636,"props":2842,"children":2843},{"style":651},[2844],{"type":612,"value":2845}," =",{"type":606,"tag":636,"props":2847,"children":2848},{"style":676},[2849],{"type":612,"value":1875},{"type":606,"tag":636,"props":2851,"children":2852},{"class":638,"line":36},[2853,2857],{"type":606,"tag":636,"props":2854,"children":2855},{"style":651},[2856],{"type":612,"value":654},{"type":606,"tag":636,"props":2858,"children":2859},{"style":657},[2860],{"type":612,"value":660},{"type":606,"tag":636,"props":2862,"children":2863},{"class":638,"line":45},[2864,2869,2873,2877,2881,2886,2890,2895],{"type":606,"tag":636,"props":2865,"children":2866},{"style":2837},[2867],{"type":612,"value":2868},"    file",{"type":606,"tag":636,"props":2870,"children":2871},{"style":651},[2872],{"type":612,"value":2845},{"type":606,"tag":636,"props":2874,"children":2875},{"style":676},[2876],{"type":612,"value":1566},{"type":606,"tag":636,"props":2878,"children":2879},{"style":657},[2880],{"type":612,"value":719},{"type":606,"tag":636,"props":2882,"children":2883},{"style":722},[2884],{"type":612,"value":2885},"\"data.txt\"",{"type":606,"tag":636,"props":2887,"children":2888},{"style":657},[2889],{"type":612,"value":1912},{"type":606,"tag":636,"props":2891,"children":2892},{"style":722},[2893],{"type":612,"value":2894},"\"w\"",{"type":606,"tag":636,"props":2896,"children":2897},{"style":657},[2898],{"type":612,"value":730},{"type":606,"tag":636,"props":2900,"children":2901},{"class":638,"line":54},[2902,2906,2911,2916],{"type":606,"tag":636,"props":2903,"children":2904},{"style":2837},[2905],{"type":612,"value":2868},{"type":606,"tag":636,"props":2907,"children":2908},{"style":657},[2909],{"type":612,"value":2910},".write(",{"type":606,"tag":636,"props":2912,"children":2913},{"style":722},[2914],{"type":612,"value":2915},"\"test data\"",{"type":606,"tag":636,"props":2917,"children":2918},{"style":657},[2919],{"type":612,"value":730},{"type":606,"tag":636,"props":2921,"children":2922},{"class":638,"line":63},[2923,2927,2932],{"type":606,"tag":636,"props":2924,"children":2925},{"style":651},[2926],{"type":612,"value":697},{"type":606,"tag":636,"props":2928,"children":2929},{"style":676},[2930],{"type":612,"value":2931}," IOError",{"type":606,"tag":636,"props":2933,"children":2934},{"style":657},[2935],{"type":612,"value":660},{"type":606,"tag":636,"props":2937,"children":2938},{"class":638,"line":72},[2939,2943,2947,2952],{"type":606,"tag":636,"props":2940,"children":2941},{"style":676},[2942],{"type":612,"value":714},{"type":606,"tag":636,"props":2944,"children":2945},{"style":657},[2946],{"type":612,"value":719},{"type":606,"tag":636,"props":2948,"children":2949},{"style":722},[2950],{"type":612,"value":2951},"\"File operation failed\"",{"type":606,"tag":636,"props":2953,"children":2954},{"style":657},[2955],{"type":612,"value":730},{"type":606,"tag":636,"props":2957,"children":2958},{"class":638,"line":81},[2959,2964],{"type":606,"tag":636,"props":2960,"children":2961},{"style":651},[2962],{"type":612,"value":2963},"finally",{"type":606,"tag":636,"props":2965,"children":2966},{"style":657},[2967],{"type":612,"value":660},{"type":606,"tag":636,"props":2969,"children":2970},{"class":638,"line":1039},[2971,2976,2981],{"type":606,"tag":636,"props":2972,"children":2973},{"style":651},[2974],{"type":612,"value":2975},"    if",{"type":606,"tag":636,"props":2977,"children":2978},{"style":2837},[2979],{"type":612,"value":2980}," file",{"type":606,"tag":636,"props":2982,"children":2983},{"style":657},[2984],{"type":612,"value":660},{"type":606,"tag":636,"props":2986,"children":2987},{"class":638,"line":99},[2988,2993],{"type":606,"tag":636,"props":2989,"children":2990},{"style":2837},[2991],{"type":612,"value":2992},"        file",{"type":606,"tag":636,"props":2994,"children":2995},{"style":657},[2996],{"type":612,"value":2997},".close()\n",{"type":606,"tag":636,"props":2999,"children":3000},{"class":638,"line":108},[3001,3005,3009,3014],{"type":606,"tag":636,"props":3002,"children":3003},{"style":676},[3004],{"type":612,"value":1804},{"type":606,"tag":636,"props":3006,"children":3007},{"style":657},[3008],{"type":612,"value":719},{"type":606,"tag":636,"props":3010,"children":3011},{"style":722},[3012],{"type":612,"value":3013},"\"File closed\"",{"type":606,"tag":636,"props":3015,"children":3016},{"style":657},[3017],{"type":612,"value":730},{"type":606,"tag":913,"props":3019,"children":3021},{"id":3020},"else-block",[3022],{"type":612,"value":3023},"Else Block",{"type":606,"tag":621,"props":3025,"children":3026},{},[3027],{"type":606,"tag":625,"props":3028,"children":3030},{"className":627,"code":3029,"language":629,"meta":8,"style":8},"# Else runs if no exceptions occur\ndef safe_conversion(value):\n    try:\n        number = int(value)\n    except ValueError:\n        print(\"Conversion failed\")\n        return None\n    else:\n        print(\"Conversion successful\")\n        return number\n    finally:\n        print(\"Conversion attempt completed\")\n\nresult1 = safe_conversion(\"42\")\nresult2 = safe_conversion(\"abc\")\n",[3031],{"type":606,"tag":632,"props":3032,"children":3033},{"__ignoreMap":8},[3034,3042,3059,3070,3091,3106,3126,3137,3149,3169,3181,3193,3213,3220,3246],{"type":606,"tag":636,"props":3035,"children":3036},{"class":638,"line":12},[3037],{"type":606,"tag":636,"props":3038,"children":3039},{"style":642},[3040],{"type":612,"value":3041},"# Else runs if no exceptions occur\n",{"type":606,"tag":636,"props":3043,"children":3044},{"class":638,"line":27},[3045,3049,3054],{"type":606,"tag":636,"props":3046,"children":3047},{"style":651},[3048],{"type":612,"value":1717},{"type":606,"tag":636,"props":3050,"children":3051},{"style":1720},[3052],{"type":612,"value":3053}," safe_conversion",{"type":606,"tag":636,"props":3055,"children":3056},{"style":657},[3057],{"type":612,"value":3058},"(value):\n",{"type":606,"tag":636,"props":3060,"children":3061},{"class":638,"line":36},[3062,3066],{"type":606,"tag":636,"props":3063,"children":3064},{"style":651},[3065],{"type":612,"value":1736},{"type":606,"tag":636,"props":3067,"children":3068},{"style":657},[3069],{"type":612,"value":660},{"type":606,"tag":636,"props":3071,"children":3072},{"class":638,"line":45},[3073,3078,3082,3086],{"type":606,"tag":636,"props":3074,"children":3075},{"style":657},[3076],{"type":612,"value":3077},"        number ",{"type":606,"tag":636,"props":3079,"children":3080},{"style":651},[3081],{"type":612,"value":673},{"type":606,"tag":636,"props":3083,"children":3084},{"style":676},[3085],{"type":612,"value":1065},{"type":606,"tag":636,"props":3087,"children":3088},{"style":657},[3089],{"type":612,"value":3090},"(value)\n",{"type":606,"tag":636,"props":3092,"children":3093},{"class":638,"line":54},[3094,3098,3102],{"type":606,"tag":636,"props":3095,"children":3096},{"style":651},[3097],{"type":612,"value":1788},{"type":606,"tag":636,"props":3099,"children":3100},{"style":676},[3101],{"type":612,"value":1090},{"type":606,"tag":636,"props":3103,"children":3104},{"style":657},[3105],{"type":612,"value":660},{"type":606,"tag":636,"props":3107,"children":3108},{"class":638,"line":63},[3109,3113,3117,3122],{"type":606,"tag":636,"props":3110,"children":3111},{"style":676},[3112],{"type":612,"value":1804},{"type":606,"tag":636,"props":3114,"children":3115},{"style":657},[3116],{"type":612,"value":719},{"type":606,"tag":636,"props":3118,"children":3119},{"style":722},[3120],{"type":612,"value":3121},"\"Conversion failed\"",{"type":606,"tag":636,"props":3123,"children":3124},{"style":657},[3125],{"type":612,"value":730},{"type":606,"tag":636,"props":3127,"children":3128},{"class":638,"line":72},[3129,3133],{"type":606,"tag":636,"props":3130,"children":3131},{"style":651},[3132],{"type":612,"value":1775},{"type":606,"tag":636,"props":3134,"children":3135},{"style":676},[3136],{"type":612,"value":1875},{"type":606,"tag":636,"props":3138,"children":3139},{"class":638,"line":81},[3140,3145],{"type":606,"tag":636,"props":3141,"children":3142},{"style":651},[3143],{"type":612,"value":3144},"    else",{"type":606,"tag":636,"props":3146,"children":3147},{"style":657},[3148],{"type":612,"value":660},{"type":606,"tag":636,"props":3150,"children":3151},{"class":638,"line":1039},[3152,3156,3160,3165],{"type":606,"tag":636,"props":3153,"children":3154},{"style":676},[3155],{"type":612,"value":1804},{"type":606,"tag":636,"props":3157,"children":3158},{"style":657},[3159],{"type":612,"value":719},{"type":606,"tag":636,"props":3161,"children":3162},{"style":722},[3163],{"type":612,"value":3164},"\"Conversion successful\"",{"type":606,"tag":636,"props":3166,"children":3167},{"style":657},[3168],{"type":612,"value":730},{"type":606,"tag":636,"props":3170,"children":3171},{"class":638,"line":99},[3172,3176],{"type":606,"tag":636,"props":3173,"children":3174},{"style":651},[3175],{"type":612,"value":1775},{"type":606,"tag":636,"props":3177,"children":3178},{"style":657},[3179],{"type":612,"value":3180}," number\n",{"type":606,"tag":636,"props":3182,"children":3183},{"class":638,"line":108},[3184,3189],{"type":606,"tag":636,"props":3185,"children":3186},{"style":651},[3187],{"type":612,"value":3188},"    finally",{"type":606,"tag":636,"props":3190,"children":3191},{"style":657},[3192],{"type":612,"value":660},{"type":606,"tag":636,"props":3194,"children":3195},{"class":638,"line":117},[3196,3200,3204,3209],{"type":606,"tag":636,"props":3197,"children":3198},{"style":676},[3199],{"type":612,"value":1804},{"type":606,"tag":636,"props":3201,"children":3202},{"style":657},[3203],{"type":612,"value":719},{"type":606,"tag":636,"props":3205,"children":3206},{"style":722},[3207],{"type":612,"value":3208},"\"Conversion attempt completed\"",{"type":606,"tag":636,"props":3210,"children":3211},{"style":657},[3212],{"type":612,"value":730},{"type":606,"tag":636,"props":3214,"children":3215},{"class":638,"line":126},[3216],{"type":606,"tag":636,"props":3217,"children":3218},{"emptyLinePlaceholder":13},[3219],{"type":612,"value":753},{"type":606,"tag":636,"props":3221,"children":3222},{"class":638,"line":135},[3223,3228,3232,3237,3242],{"type":606,"tag":636,"props":3224,"children":3225},{"style":657},[3226],{"type":612,"value":3227},"result1 ",{"type":606,"tag":636,"props":3229,"children":3230},{"style":651},[3231],{"type":612,"value":673},{"type":606,"tag":636,"props":3233,"children":3234},{"style":657},[3235],{"type":612,"value":3236}," safe_conversion(",{"type":606,"tag":636,"props":3238,"children":3239},{"style":722},[3240],{"type":612,"value":3241},"\"42\"",{"type":606,"tag":636,"props":3243,"children":3244},{"style":657},[3245],{"type":612,"value":730},{"type":606,"tag":636,"props":3247,"children":3248},{"class":638,"line":144},[3249,3254,3258,3262,3266],{"type":606,"tag":636,"props":3250,"children":3251},{"style":657},[3252],{"type":612,"value":3253},"result2 ",{"type":606,"tag":636,"props":3255,"children":3256},{"style":651},[3257],{"type":612,"value":673},{"type":606,"tag":636,"props":3259,"children":3260},{"style":657},[3261],{"type":612,"value":3236},{"type":606,"tag":636,"props":3263,"children":3264},{"style":722},[3265],{"type":612,"value":1074},{"type":606,"tag":636,"props":3267,"children":3268},{"style":657},[3269],{"type":612,"value":730},{"type":606,"tag":913,"props":3271,"children":3273},{"id":3272},"complete-exception-structure",[3274],{"type":612,"value":3275},"Complete Exception Structure",{"type":606,"tag":621,"props":3277,"children":3278},{},[3279],{"type":606,"tag":625,"props":3280,"children":3282},{"className":627,"code":3281,"language":629,"meta":8,"style":8},"def process_data(data):\n    try:\n        # Try to process the data\n        processed = data.upper().strip()\n        length = len(processed)\n    except AttributeError:\n        print(\"Data is not a string\")\n        return None\n    except Exception as e:\n        print(f\"Unexpected error: {e}\")\n        return None\n    else:\n        print(\"Processing successful\")\n        return processed\n    finally:\n        print(\"Processing attempt finished\")\n\n# Test the function\nresult1 = process_data(\"  hello world  \")\nresult2 = process_data(123)\n",[3283],{"type":606,"tag":632,"props":3284,"children":3285},{"__ignoreMap":8},[3286,3303,3314,3322,3339,3361,3377,3397,3408,3427,3466,3477,3488,3508,3520,3531,3551,3558,3566,3591],{"type":606,"tag":636,"props":3287,"children":3288},{"class":638,"line":12},[3289,3293,3298],{"type":606,"tag":636,"props":3290,"children":3291},{"style":651},[3292],{"type":612,"value":1717},{"type":606,"tag":636,"props":3294,"children":3295},{"style":1720},[3296],{"type":612,"value":3297}," process_data",{"type":606,"tag":636,"props":3299,"children":3300},{"style":657},[3301],{"type":612,"value":3302},"(data):\n",{"type":606,"tag":636,"props":3304,"children":3305},{"class":638,"line":27},[3306,3310],{"type":606,"tag":636,"props":3307,"children":3308},{"style":651},[3309],{"type":612,"value":1736},{"type":606,"tag":636,"props":3311,"children":3312},{"style":657},[3313],{"type":612,"value":660},{"type":606,"tag":636,"props":3315,"children":3316},{"class":638,"line":36},[3317],{"type":606,"tag":636,"props":3318,"children":3319},{"style":642},[3320],{"type":612,"value":3321},"        # Try to process the data\n",{"type":606,"tag":636,"props":3323,"children":3324},{"class":638,"line":45},[3325,3330,3334],{"type":606,"tag":636,"props":3326,"children":3327},{"style":657},[3328],{"type":612,"value":3329},"        processed ",{"type":606,"tag":636,"props":3331,"children":3332},{"style":651},[3333],{"type":612,"value":673},{"type":606,"tag":636,"props":3335,"children":3336},{"style":657},[3337],{"type":612,"value":3338}," data.upper().strip()\n",{"type":606,"tag":636,"props":3340,"children":3341},{"class":638,"line":54},[3342,3347,3351,3356],{"type":606,"tag":636,"props":3343,"children":3344},{"style":657},[3345],{"type":612,"value":3346},"        length ",{"type":606,"tag":636,"props":3348,"children":3349},{"style":651},[3350],{"type":612,"value":673},{"type":606,"tag":636,"props":3352,"children":3353},{"style":676},[3354],{"type":612,"value":3355}," len",{"type":606,"tag":636,"props":3357,"children":3358},{"style":657},[3359],{"type":612,"value":3360},"(processed)\n",{"type":606,"tag":636,"props":3362,"children":3363},{"class":638,"line":63},[3364,3368,3373],{"type":606,"tag":636,"props":3365,"children":3366},{"style":651},[3367],{"type":612,"value":1788},{"type":606,"tag":636,"props":3369,"children":3370},{"style":676},[3371],{"type":612,"value":3372}," AttributeError",{"type":606,"tag":636,"props":3374,"children":3375},{"style":657},[3376],{"type":612,"value":660},{"type":606,"tag":636,"props":3378,"children":3379},{"class":638,"line":72},[3380,3384,3388,3393],{"type":606,"tag":636,"props":3381,"children":3382},{"style":676},[3383],{"type":612,"value":1804},{"type":606,"tag":636,"props":3385,"children":3386},{"style":657},[3387],{"type":612,"value":719},{"type":606,"tag":636,"props":3389,"children":3390},{"style":722},[3391],{"type":612,"value":3392},"\"Data is not a string\"",{"type":606,"tag":636,"props":3394,"children":3395},{"style":657},[3396],{"type":612,"value":730},{"type":606,"tag":636,"props":3398,"children":3399},{"class":638,"line":81},[3400,3404],{"type":606,"tag":636,"props":3401,"children":3402},{"style":651},[3403],{"type":612,"value":1775},{"type":606,"tag":636,"props":3405,"children":3406},{"style":676},[3407],{"type":612,"value":1875},{"type":606,"tag":636,"props":3409,"children":3410},{"class":638,"line":1039},[3411,3415,3419,3423],{"type":606,"tag":636,"props":3412,"children":3413},{"style":651},[3414],{"type":612,"value":1788},{"type":606,"tag":636,"props":3416,"children":3417},{"style":676},[3418],{"type":612,"value":2267},{"type":606,"tag":636,"props":3420,"children":3421},{"style":651},[3422],{"type":612,"value":1434},{"type":606,"tag":636,"props":3424,"children":3425},{"style":657},[3426],{"type":612,"value":1439},{"type":606,"tag":636,"props":3428,"children":3429},{"class":638,"line":99},[3430,3434,3438,3442,3446,3450,3454,3458,3462],{"type":606,"tag":636,"props":3431,"children":3432},{"style":676},[3433],{"type":612,"value":1804},{"type":606,"tag":636,"props":3435,"children":3436},{"style":657},[3437],{"type":612,"value":719},{"type":606,"tag":636,"props":3439,"children":3440},{"style":651},[3441],{"type":612,"value":770},{"type":606,"tag":636,"props":3443,"children":3444},{"style":722},[3445],{"type":612,"value":2295},{"type":606,"tag":636,"props":3447,"children":3448},{"style":676},[3449],{"type":612,"value":780},{"type":606,"tag":636,"props":3451,"children":3452},{"style":657},[3453],{"type":612,"value":1468},{"type":606,"tag":636,"props":3455,"children":3456},{"style":676},[3457],{"type":612,"value":790},{"type":606,"tag":636,"props":3459,"children":3460},{"style":722},[3461],{"type":612,"value":795},{"type":606,"tag":636,"props":3463,"children":3464},{"style":657},[3465],{"type":612,"value":730},{"type":606,"tag":636,"props":3467,"children":3468},{"class":638,"line":108},[3469,3473],{"type":606,"tag":636,"props":3470,"children":3471},{"style":651},[3472],{"type":612,"value":1775},{"type":606,"tag":636,"props":3474,"children":3475},{"style":676},[3476],{"type":612,"value":1875},{"type":606,"tag":636,"props":3478,"children":3479},{"class":638,"line":117},[3480,3484],{"type":606,"tag":636,"props":3481,"children":3482},{"style":651},[3483],{"type":612,"value":3144},{"type":606,"tag":636,"props":3485,"children":3486},{"style":657},[3487],{"type":612,"value":660},{"type":606,"tag":636,"props":3489,"children":3490},{"class":638,"line":126},[3491,3495,3499,3504],{"type":606,"tag":636,"props":3492,"children":3493},{"style":676},[3494],{"type":612,"value":1804},{"type":606,"tag":636,"props":3496,"children":3497},{"style":657},[3498],{"type":612,"value":719},{"type":606,"tag":636,"props":3500,"children":3501},{"style":722},[3502],{"type":612,"value":3503},"\"Processing successful\"",{"type":606,"tag":636,"props":3505,"children":3506},{"style":657},[3507],{"type":612,"value":730},{"type":606,"tag":636,"props":3509,"children":3510},{"class":638,"line":135},[3511,3515],{"type":606,"tag":636,"props":3512,"children":3513},{"style":651},[3514],{"type":612,"value":1775},{"type":606,"tag":636,"props":3516,"children":3517},{"style":657},[3518],{"type":612,"value":3519}," processed\n",{"type":606,"tag":636,"props":3521,"children":3522},{"class":638,"line":144},[3523,3527],{"type":606,"tag":636,"props":3524,"children":3525},{"style":651},[3526],{"type":612,"value":3188},{"type":606,"tag":636,"props":3528,"children":3529},{"style":657},[3530],{"type":612,"value":660},{"type":606,"tag":636,"props":3532,"children":3533},{"class":638,"line":153},[3534,3538,3542,3547],{"type":606,"tag":636,"props":3535,"children":3536},{"style":676},[3537],{"type":612,"value":1804},{"type":606,"tag":636,"props":3539,"children":3540},{"style":657},[3541],{"type":612,"value":719},{"type":606,"tag":636,"props":3543,"children":3544},{"style":722},[3545],{"type":612,"value":3546},"\"Processing attempt finished\"",{"type":606,"tag":636,"props":3548,"children":3549},{"style":657},[3550],{"type":612,"value":730},{"type":606,"tag":636,"props":3552,"children":3553},{"class":638,"line":163},[3554],{"type":606,"tag":636,"props":3555,"children":3556},{"emptyLinePlaceholder":13},[3557],{"type":612,"value":753},{"type":606,"tag":636,"props":3559,"children":3560},{"class":638,"line":172},[3561],{"type":606,"tag":636,"props":3562,"children":3563},{"style":642},[3564],{"type":612,"value":3565},"# Test the function\n",{"type":606,"tag":636,"props":3567,"children":3568},{"class":638,"line":181},[3569,3573,3577,3582,3587],{"type":606,"tag":636,"props":3570,"children":3571},{"style":657},[3572],{"type":612,"value":3227},{"type":606,"tag":636,"props":3574,"children":3575},{"style":651},[3576],{"type":612,"value":673},{"type":606,"tag":636,"props":3578,"children":3579},{"style":657},[3580],{"type":612,"value":3581}," process_data(",{"type":606,"tag":636,"props":3583,"children":3584},{"style":722},[3585],{"type":612,"value":3586},"\"  hello world  \"",{"type":606,"tag":636,"props":3588,"children":3589},{"style":657},[3590],{"type":612,"value":730},{"type":606,"tag":636,"props":3592,"children":3593},{"class":638,"line":190},[3594,3598,3602,3606,3611],{"type":606,"tag":636,"props":3595,"children":3596},{"style":657},[3597],{"type":612,"value":3253},{"type":606,"tag":636,"props":3599,"children":3600},{"style":651},[3601],{"type":612,"value":673},{"type":606,"tag":636,"props":3603,"children":3604},{"style":657},[3605],{"type":612,"value":3581},{"type":606,"tag":636,"props":3607,"children":3608},{"style":676},[3609],{"type":612,"value":3610},"123",{"type":606,"tag":636,"props":3612,"children":3613},{"style":657},[3614],{"type":612,"value":730},{"type":606,"tag":801,"props":3616,"children":3618},{"id":3617},"exception-handling-reference",[3619],{"type":612,"value":3620},"📊 Exception Handling Reference",{"type":606,"tag":913,"props":3622,"children":3624},{"id":3623},"common-exception-types",[3625],{"type":612,"value":3626},"Common Exception Types",{"type":606,"tag":2660,"props":3628,"children":3629},{},[3630,3651],{"type":606,"tag":2664,"props":3631,"children":3632},{},[3633],{"type":606,"tag":2668,"props":3634,"children":3635},{},[3636,3641,3646],{"type":606,"tag":2672,"props":3637,"children":3638},{},[3639],{"type":612,"value":3640},"Exception",{"type":606,"tag":2672,"props":3642,"children":3643},{},[3644],{"type":612,"value":3645},"Cause",{"type":606,"tag":2672,"props":3647,"children":3648},{},[3649],{"type":612,"value":3650},"Example Code",{"type":606,"tag":2688,"props":3652,"children":3653},{},[3654,3679,3704,3729,3755,3781,3807],{"type":606,"tag":2668,"props":3655,"children":3656},{},[3657,3665,3670],{"type":606,"tag":2695,"props":3658,"children":3659},{},[3660],{"type":606,"tag":632,"props":3661,"children":3663},{"className":3662},[],[3664],{"type":612,"value":2117},{"type":606,"tag":2695,"props":3666,"children":3667},{},[3668],{"type":612,"value":3669},"Invalid value",{"type":606,"tag":2695,"props":3671,"children":3672},{},[3673],{"type":606,"tag":632,"props":3674,"children":3676},{"className":3675},[],[3677],{"type":612,"value":3678},"int(\"abc\")",{"type":606,"tag":2668,"props":3680,"children":3681},{},[3682,3690,3695],{"type":606,"tag":2695,"props":3683,"children":3684},{},[3685],{"type":606,"tag":632,"props":3686,"children":3688},{"className":3687},[],[3689],{"type":612,"value":2126},{"type":606,"tag":2695,"props":3691,"children":3692},{},[3693],{"type":612,"value":3694},"Wrong type",{"type":606,"tag":2695,"props":3696,"children":3697},{},[3698],{"type":606,"tag":632,"props":3699,"children":3701},{"className":3700},[],[3702],{"type":612,"value":3703},"\"text\" + 5",{"type":606,"tag":2668,"props":3705,"children":3706},{},[3707,3715,3720],{"type":606,"tag":2695,"props":3708,"children":3709},{},[3710],{"type":606,"tag":632,"props":3711,"children":3713},{"className":3712},[],[3714],{"type":612,"value":2135},{"type":606,"tag":2695,"props":3716,"children":3717},{},[3718],{"type":612,"value":3719},"Missing dict key",{"type":606,"tag":2695,"props":3721,"children":3722},{},[3723],{"type":606,"tag":632,"props":3724,"children":3726},{"className":3725},[],[3727],{"type":612,"value":3728},"d[\"missing\"]",{"type":606,"tag":2668,"props":3730,"children":3731},{},[3732,3741,3746],{"type":606,"tag":2695,"props":3733,"children":3734},{},[3735],{"type":606,"tag":632,"props":3736,"children":3738},{"className":3737},[],[3739],{"type":612,"value":3740},"IndexError",{"type":606,"tag":2695,"props":3742,"children":3743},{},[3744],{"type":612,"value":3745},"Invalid index",{"type":606,"tag":2695,"props":3747,"children":3748},{},[3749],{"type":606,"tag":632,"props":3750,"children":3752},{"className":3751},[],[3753],{"type":612,"value":3754},"list[100]",{"type":606,"tag":2668,"props":3756,"children":3757},{},[3758,3767,3772],{"type":606,"tag":2695,"props":3759,"children":3760},{},[3761],{"type":606,"tag":632,"props":3762,"children":3764},{"className":3763},[],[3765],{"type":612,"value":3766},"AttributeError",{"type":606,"tag":2695,"props":3768,"children":3769},{},[3770],{"type":612,"value":3771},"Missing attribute",{"type":606,"tag":2695,"props":3773,"children":3774},{},[3775],{"type":606,"tag":632,"props":3776,"children":3778},{"className":3777},[],[3779],{"type":612,"value":3780},"obj.missing()",{"type":606,"tag":2668,"props":3782,"children":3783},{},[3784,3793,3798],{"type":606,"tag":2695,"props":3785,"children":3786},{},[3787],{"type":606,"tag":632,"props":3788,"children":3790},{"className":3789},[],[3791],{"type":612,"value":3792},"FileNotFoundError",{"type":606,"tag":2695,"props":3794,"children":3795},{},[3796],{"type":612,"value":3797},"Missing file",{"type":606,"tag":2695,"props":3799,"children":3800},{},[3801],{"type":606,"tag":632,"props":3802,"children":3804},{"className":3803},[],[3805],{"type":612,"value":3806},"open(\"missing.txt\")",{"type":606,"tag":2668,"props":3808,"children":3809},{},[3810,3819,3824],{"type":606,"tag":2695,"props":3811,"children":3812},{},[3813],{"type":606,"tag":632,"props":3814,"children":3816},{"className":3815},[],[3817],{"type":612,"value":3818},"ZeroDivisionError",{"type":606,"tag":2695,"props":3820,"children":3821},{},[3822],{"type":612,"value":3823},"Division by zero",{"type":606,"tag":2695,"props":3825,"children":3826},{},[3827],{"type":606,"tag":632,"props":3828,"children":3830},{"className":3829},[],[3831],{"type":612,"value":3832},"10 / 0",{"type":606,"tag":913,"props":3834,"children":3836},{"id":3835},"exception-handling-best-practices",[3837],{"type":612,"value":3838},"Exception Handling Best Practices",{"type":606,"tag":2660,"props":3840,"children":3841},{},[3842,3863],{"type":606,"tag":2664,"props":3843,"children":3844},{},[3845],{"type":606,"tag":2668,"props":3846,"children":3847},{},[3848,3853,3858],{"type":606,"tag":2672,"props":3849,"children":3850},{},[3851],{"type":612,"value":3852},"Practice",{"type":606,"tag":2672,"props":3854,"children":3855},{},[3856],{"type":612,"value":3857},"Good Example",{"type":606,"tag":2672,"props":3859,"children":3860},{},[3861],{"type":612,"value":3862},"Avoid",{"type":606,"tag":2688,"props":3864,"children":3865},{},[3866,3890,3916,3941],{"type":606,"tag":2668,"props":3867,"children":3868},{},[3869,3874,3882],{"type":606,"tag":2695,"props":3870,"children":3871},{},[3872],{"type":612,"value":3873},"Specific exceptions",{"type":606,"tag":2695,"props":3875,"children":3876},{},[3877],{"type":606,"tag":632,"props":3878,"children":3880},{"className":3879},[],[3881],{"type":612,"value":2708},{"type":606,"tag":2695,"props":3883,"children":3884},{},[3885],{"type":606,"tag":632,"props":3886,"children":3888},{"className":3887},[],[3889],{"type":612,"value":2796},{"type":606,"tag":2668,"props":3891,"children":3892},{},[3893,3898,3907],{"type":606,"tag":2695,"props":3894,"children":3895},{},[3896],{"type":612,"value":3897},"Meaningful messages",{"type":606,"tag":2695,"props":3899,"children":3900},{},[3901],{"type":606,"tag":632,"props":3902,"children":3904},{"className":3903},[],[3905],{"type":612,"value":3906},"print(\"Invalid input\")",{"type":606,"tag":2695,"props":3908,"children":3909},{},[3910],{"type":606,"tag":632,"props":3911,"children":3913},{"className":3912},[],[3914],{"type":612,"value":3915},"print(\"Error\")",{"type":606,"tag":2668,"props":3917,"children":3918},{},[3919,3924,3933],{"type":606,"tag":2695,"props":3920,"children":3921},{},[3922],{"type":612,"value":3923},"Handle what you expect",{"type":606,"tag":2695,"props":3925,"children":3926},{},[3927],{"type":606,"tag":632,"props":3928,"children":3930},{"className":3929},[],[3931],{"type":612,"value":3932},"except FileNotFoundError:",{"type":606,"tag":2695,"props":3934,"children":3935},{},[3936],{"type":606,"tag":632,"props":3937,"children":3939},{"className":3938},[],[3940],{"type":612,"value":2774},{"type":606,"tag":2668,"props":3942,"children":3943},{},[3944,3949,3958],{"type":606,"tag":2695,"props":3945,"children":3946},{},[3947],{"type":612,"value":3948},"Use finally for cleanup",{"type":606,"tag":2695,"props":3950,"children":3951},{},[3952],{"type":606,"tag":632,"props":3953,"children":3955},{"className":3954},[],[3956],{"type":612,"value":3957},"finally: file.close()",{"type":606,"tag":2695,"props":3959,"children":3960},{},[3961],{"type":612,"value":3962},"Ignoring cleanup",{"type":606,"tag":801,"props":3964,"children":3966},{"id":3965},"key-takeaways",[3967],{"type":612,"value":3968},"🎯 Key Takeaways",{"type":606,"tag":813,"props":3970,"children":3974},{"emoji":3971,"title":3972,"type":3973},"📚","Exception Handling Essentials","success",[3975,3983,4027,4035,4057,4065,4089],{"type":606,"tag":615,"props":3976,"children":3977},{},[3978],{"type":606,"tag":823,"props":3979,"children":3980},{},[3981],{"type":612,"value":3982},"Core Structure:",{"type":606,"tag":883,"props":3984,"children":3985},{},[3986,3996,4006,4017],{"type":606,"tag":887,"props":3987,"children":3988},{},[3989,3994],{"type":606,"tag":632,"props":3990,"children":3992},{"className":3991},[],[3993],{"type":612,"value":654},{"type":612,"value":3995},": Code that might fail",{"type":606,"tag":887,"props":3997,"children":3998},{},[3999,4004],{"type":606,"tag":632,"props":4000,"children":4002},{"className":4001},[],[4003],{"type":612,"value":697},{"type":612,"value":4005},": Handle specific exceptions",{"type":606,"tag":887,"props":4007,"children":4008},{},[4009,4015],{"type":606,"tag":632,"props":4010,"children":4012},{"className":4011},[],[4013],{"type":612,"value":4014},"else",{"type":612,"value":4016},": Run if no exceptions",{"type":606,"tag":887,"props":4018,"children":4019},{},[4020,4025],{"type":606,"tag":632,"props":4021,"children":4023},{"className":4022},[],[4024],{"type":612,"value":2963},{"type":612,"value":4026},": Always execute cleanup",{"type":606,"tag":615,"props":4028,"children":4029},{},[4030],{"type":606,"tag":823,"props":4031,"children":4032},{},[4033],{"type":612,"value":4034},"Best Practices:",{"type":606,"tag":883,"props":4036,"children":4037},{},[4038,4043,4048,4052],{"type":606,"tag":887,"props":4039,"children":4040},{},[4041],{"type":612,"value":4042},"Catch specific exceptions",{"type":606,"tag":887,"props":4044,"children":4045},{},[4046],{"type":612,"value":4047},"Provide helpful error messages",{"type":606,"tag":887,"props":4049,"children":4050},{},[4051],{"type":612,"value":3948},{"type":606,"tag":887,"props":4053,"children":4054},{},[4055],{"type":612,"value":4056},"Handle exceptions you can recover from",{"type":606,"tag":615,"props":4058,"children":4059},{},[4060],{"type":606,"tag":823,"props":4061,"children":4062},{},[4063],{"type":612,"value":4064},"Common Patterns:",{"type":606,"tag":883,"props":4066,"children":4067},{},[4068,4073,4084],{"type":606,"tag":887,"props":4069,"children":4070},{},[4071],{"type":612,"value":4072},"Multiple except blocks for different errors",{"type":606,"tag":887,"props":4074,"children":4075},{},[4076,4078],{"type":612,"value":4077},"Exception chaining with ",{"type":606,"tag":632,"props":4079,"children":4081},{"className":4080},[],[4082],{"type":612,"value":4083},"as e",{"type":606,"tag":887,"props":4085,"children":4086},{},[4087],{"type":612,"value":4088},"Using exception hierarchy effectively",{"type":606,"tag":615,"props":4090,"children":4091},{},[4092,4097],{"type":606,"tag":823,"props":4093,"children":4094},{},[4095],{"type":612,"value":4096},"Remember:",{"type":612,"value":4098}," Handle exceptions you can recover from, let others propagate up!",{"type":606,"tag":801,"props":4100,"children":4102},{"id":4101},"whats-next",[4103],{"type":612,"value":4104},"🚀 What's Next?",{"type":606,"tag":615,"props":4106,"children":4107},{},[4108],{"type":612,"value":4109},"Learn how to create your own custom exception classes for specific error scenarios.",{"type":606,"tag":615,"props":4111,"children":4112},{},[4113,4118,4119],{"type":606,"tag":823,"props":4114,"children":4115},{},[4116],{"type":612,"value":4117},"Continue to",{"type":612,"value":1171},{"type":606,"tag":4120,"props":4121,"children":4122},"a",{"href":372},[4123],{"type":612,"value":373},{"type":606,"tag":4125,"props":4126,"children":4127},"style",{},[4128],{"type":612,"value":4129},"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":4131},[4132,4136,4141,4142,4147,4151,4152],{"id":803,"depth":27,"text":806,"children":4133},[4134,4135],{"id":915,"depth":36,"text":918},{"id":1358,"depth":36,"text":1361},{"id":1685,"depth":27,"text":1688,"children":4137},[4138,4139,4140],{"id":1696,"depth":36,"text":1699},{"id":1997,"depth":36,"text":2000},{"id":2379,"depth":36,"text":2382},{"id":2655,"depth":27,"text":2658},{"id":2804,"depth":27,"text":2807,"children":4143},[4144,4145,4146],{"id":2810,"depth":36,"text":2813},{"id":3020,"depth":36,"text":3023},{"id":3272,"depth":36,"text":3275},{"id":3617,"depth":27,"text":3620,"children":4148},[4149,4150],{"id":3623,"depth":36,"text":3626},{"id":3835,"depth":36,"text":3838},{"id":3965,"depth":27,"text":3968},{"id":4101,"depth":27,"text":4104},1782373759328]