[{"data":1,"prerenderedAt":5402},["ShallowReactive",2],{"tutorials-python-how-to":3,"category-items-python-how-to":600,"content-/python-how-to/parse-xml-html":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,"expanded":13},"/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,"expanded":13},"/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",[492],{"_path":493,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":494,"description":495,"slug":496,"parentId":473,"order":497,"body":602,"_type":15,"_id":498,"_source":17,"_file":499,"_stem":500,"_extension":20},{"type":603,"children":604,"toc":5386},"root",[605,614,620,1101,1108,1113,1239,1246,1759,1765,2355,2361,2550,2556,2562,3374,3380,4242,4248,4254,5197,5203,5355,5361,5366,5380],{"type":606,"tag":607,"props":608,"children":610},"element","h1",{"id":609},"parsing-xml-and-html",[611],{"type":612,"value":613},"text","🌐 Parsing XML and HTML",{"type":606,"tag":615,"props":616,"children":617},"p",{},[618],{"type":612,"value":619},"XML and HTML are structured markup languages used for data storage and web content. Python provides powerful tools to parse these formats and extract the information you need.",{"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","import xml.etree.ElementTree as ET\n\n# Sample XML data\nxml_data = \"\"\"\n\u003Cbooks>\n    \u003Cbook id=\"1\">\n        \u003Ctitle>Python Programming\u003C/title>\n        \u003Cauthor>John Doe\u003C/author>\n        \u003Cprice>29.99\u003C/price>\n    \u003C/book>\n    \u003Cbook id=\"2\">\n        \u003Ctitle>Web Development\u003C/title>\n        \u003Cauthor>Jane Smith\u003C/author>\n        \u003Cprice>34.99\u003C/price>\n    \u003C/book>\n\u003C/books>\n\"\"\"\n\n# Parse XML\nroot = ET.fromstring(xml_data)\n\n# Extract book information\nfor book in root.findall('book'):\n    book_id = book.get('id')\n    title = book.find('title').text\n    author = book.find('author').text\n    price = book.find('price').text\n    \n    print(f\"Book {book_id}: {title} by {author} - ${price}\")\n","python",[631],{"type":606,"tag":632,"props":633,"children":634},"code",{"__ignoreMap":8},[635,663,671,680,699,707,715,723,731,740,748,756,764,772,780,787,795,803,810,818,840,847,855,888,915,942,967,992,1000],{"type":606,"tag":636,"props":637,"children":639},"span",{"class":638,"line":12},"line",[640,646,652,657],{"type":606,"tag":636,"props":641,"children":643},{"style":642},"--shiki-default:#D73A49;--shiki-app-dark-mode:#F97583",[644],{"type":612,"value":645},"import",{"type":606,"tag":636,"props":647,"children":649},{"style":648},"--shiki-default:#24292E;--shiki-app-dark-mode:#E1E4E8",[650],{"type":612,"value":651}," xml.etree.ElementTree ",{"type":606,"tag":636,"props":653,"children":654},{"style":642},[655],{"type":612,"value":656},"as",{"type":606,"tag":636,"props":658,"children":660},{"style":659},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[661],{"type":612,"value":662}," ET\n",{"type":606,"tag":636,"props":664,"children":665},{"class":638,"line":27},[666],{"type":606,"tag":636,"props":667,"children":668},{"emptyLinePlaceholder":13},[669],{"type":612,"value":670},"\n",{"type":606,"tag":636,"props":672,"children":673},{"class":638,"line":36},[674],{"type":606,"tag":636,"props":675,"children":677},{"style":676},"--shiki-default:#6A737D;--shiki-app-dark-mode:#6A737D",[678],{"type":612,"value":679},"# Sample XML data\n",{"type":606,"tag":636,"props":681,"children":682},{"class":638,"line":45},[683,688,693],{"type":606,"tag":636,"props":684,"children":685},{"style":648},[686],{"type":612,"value":687},"xml_data ",{"type":606,"tag":636,"props":689,"children":690},{"style":642},[691],{"type":612,"value":692},"=",{"type":606,"tag":636,"props":694,"children":696},{"style":695},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[697],{"type":612,"value":698}," \"\"\"\n",{"type":606,"tag":636,"props":700,"children":701},{"class":638,"line":54},[702],{"type":606,"tag":636,"props":703,"children":704},{"style":695},[705],{"type":612,"value":706},"\u003Cbooks>\n",{"type":606,"tag":636,"props":708,"children":709},{"class":638,"line":63},[710],{"type":606,"tag":636,"props":711,"children":712},{"style":695},[713],{"type":612,"value":714},"    \u003Cbook id=\"1\">\n",{"type":606,"tag":636,"props":716,"children":717},{"class":638,"line":72},[718],{"type":606,"tag":636,"props":719,"children":720},{"style":695},[721],{"type":612,"value":722},"        \u003Ctitle>Python Programming\u003C/title>\n",{"type":606,"tag":636,"props":724,"children":725},{"class":638,"line":81},[726],{"type":606,"tag":636,"props":727,"children":728},{"style":695},[729],{"type":612,"value":730},"        \u003Cauthor>John Doe\u003C/author>\n",{"type":606,"tag":636,"props":732,"children":734},{"class":638,"line":733},9,[735],{"type":606,"tag":636,"props":736,"children":737},{"style":695},[738],{"type":612,"value":739},"        \u003Cprice>29.99\u003C/price>\n",{"type":606,"tag":636,"props":741,"children":742},{"class":638,"line":99},[743],{"type":606,"tag":636,"props":744,"children":745},{"style":695},[746],{"type":612,"value":747},"    \u003C/book>\n",{"type":606,"tag":636,"props":749,"children":750},{"class":638,"line":108},[751],{"type":606,"tag":636,"props":752,"children":753},{"style":695},[754],{"type":612,"value":755},"    \u003Cbook id=\"2\">\n",{"type":606,"tag":636,"props":757,"children":758},{"class":638,"line":117},[759],{"type":606,"tag":636,"props":760,"children":761},{"style":695},[762],{"type":612,"value":763},"        \u003Ctitle>Web Development\u003C/title>\n",{"type":606,"tag":636,"props":765,"children":766},{"class":638,"line":126},[767],{"type":606,"tag":636,"props":768,"children":769},{"style":695},[770],{"type":612,"value":771},"        \u003Cauthor>Jane Smith\u003C/author>\n",{"type":606,"tag":636,"props":773,"children":774},{"class":638,"line":135},[775],{"type":606,"tag":636,"props":776,"children":777},{"style":695},[778],{"type":612,"value":779},"        \u003Cprice>34.99\u003C/price>\n",{"type":606,"tag":636,"props":781,"children":782},{"class":638,"line":144},[783],{"type":606,"tag":636,"props":784,"children":785},{"style":695},[786],{"type":612,"value":747},{"type":606,"tag":636,"props":788,"children":789},{"class":638,"line":153},[790],{"type":606,"tag":636,"props":791,"children":792},{"style":695},[793],{"type":612,"value":794},"\u003C/books>\n",{"type":606,"tag":636,"props":796,"children":797},{"class":638,"line":163},[798],{"type":606,"tag":636,"props":799,"children":800},{"style":695},[801],{"type":612,"value":802},"\"\"\"\n",{"type":606,"tag":636,"props":804,"children":805},{"class":638,"line":172},[806],{"type":606,"tag":636,"props":807,"children":808},{"emptyLinePlaceholder":13},[809],{"type":612,"value":670},{"type":606,"tag":636,"props":811,"children":812},{"class":638,"line":181},[813],{"type":606,"tag":636,"props":814,"children":815},{"style":676},[816],{"type":612,"value":817},"# Parse XML\n",{"type":606,"tag":636,"props":819,"children":820},{"class":638,"line":190},[821,826,830,835],{"type":606,"tag":636,"props":822,"children":823},{"style":648},[824],{"type":612,"value":825},"root ",{"type":606,"tag":636,"props":827,"children":828},{"style":642},[829],{"type":612,"value":692},{"type":606,"tag":636,"props":831,"children":832},{"style":659},[833],{"type":612,"value":834}," ET",{"type":606,"tag":636,"props":836,"children":837},{"style":648},[838],{"type":612,"value":839},".fromstring(xml_data)\n",{"type":606,"tag":636,"props":841,"children":842},{"class":638,"line":199},[843],{"type":606,"tag":636,"props":844,"children":845},{"emptyLinePlaceholder":13},[846],{"type":612,"value":670},{"type":606,"tag":636,"props":848,"children":849},{"class":638,"line":208},[850],{"type":606,"tag":636,"props":851,"children":852},{"style":676},[853],{"type":612,"value":854},"# Extract book information\n",{"type":606,"tag":636,"props":856,"children":857},{"class":638,"line":217},[858,863,868,873,878,883],{"type":606,"tag":636,"props":859,"children":860},{"style":642},[861],{"type":612,"value":862},"for",{"type":606,"tag":636,"props":864,"children":865},{"style":648},[866],{"type":612,"value":867}," book ",{"type":606,"tag":636,"props":869,"children":870},{"style":642},[871],{"type":612,"value":872},"in",{"type":606,"tag":636,"props":874,"children":875},{"style":648},[876],{"type":612,"value":877}," root.findall(",{"type":606,"tag":636,"props":879,"children":880},{"style":695},[881],{"type":612,"value":882},"'book'",{"type":606,"tag":636,"props":884,"children":885},{"style":648},[886],{"type":612,"value":887},"):\n",{"type":606,"tag":636,"props":889,"children":890},{"class":638,"line":227},[891,896,900,905,910],{"type":606,"tag":636,"props":892,"children":893},{"style":648},[894],{"type":612,"value":895},"    book_id ",{"type":606,"tag":636,"props":897,"children":898},{"style":642},[899],{"type":612,"value":692},{"type":606,"tag":636,"props":901,"children":902},{"style":648},[903],{"type":612,"value":904}," book.get(",{"type":606,"tag":636,"props":906,"children":907},{"style":695},[908],{"type":612,"value":909},"'id'",{"type":606,"tag":636,"props":911,"children":912},{"style":648},[913],{"type":612,"value":914},")\n",{"type":606,"tag":636,"props":916,"children":917},{"class":638,"line":236},[918,923,927,932,937],{"type":606,"tag":636,"props":919,"children":920},{"style":648},[921],{"type":612,"value":922},"    title ",{"type":606,"tag":636,"props":924,"children":925},{"style":642},[926],{"type":612,"value":692},{"type":606,"tag":636,"props":928,"children":929},{"style":648},[930],{"type":612,"value":931}," book.find(",{"type":606,"tag":636,"props":933,"children":934},{"style":695},[935],{"type":612,"value":936},"'title'",{"type":606,"tag":636,"props":938,"children":939},{"style":648},[940],{"type":612,"value":941},").text\n",{"type":606,"tag":636,"props":943,"children":944},{"class":638,"line":245},[945,950,954,958,963],{"type":606,"tag":636,"props":946,"children":947},{"style":648},[948],{"type":612,"value":949},"    author ",{"type":606,"tag":636,"props":951,"children":952},{"style":642},[953],{"type":612,"value":692},{"type":606,"tag":636,"props":955,"children":956},{"style":648},[957],{"type":612,"value":931},{"type":606,"tag":636,"props":959,"children":960},{"style":695},[961],{"type":612,"value":962},"'author'",{"type":606,"tag":636,"props":964,"children":965},{"style":648},[966],{"type":612,"value":941},{"type":606,"tag":636,"props":968,"children":969},{"class":638,"line":254},[970,975,979,983,988],{"type":606,"tag":636,"props":971,"children":972},{"style":648},[973],{"type":612,"value":974},"    price ",{"type":606,"tag":636,"props":976,"children":977},{"style":642},[978],{"type":612,"value":692},{"type":606,"tag":636,"props":980,"children":981},{"style":648},[982],{"type":612,"value":931},{"type":606,"tag":636,"props":984,"children":985},{"style":695},[986],{"type":612,"value":987},"'price'",{"type":606,"tag":636,"props":989,"children":990},{"style":648},[991],{"type":612,"value":941},{"type":606,"tag":636,"props":993,"children":994},{"class":638,"line":263},[995],{"type":606,"tag":636,"props":996,"children":997},{"style":648},[998],{"type":612,"value":999},"    \n",{"type":606,"tag":636,"props":1001,"children":1002},{"class":638,"line":272},[1003,1008,1013,1018,1023,1028,1033,1038,1043,1047,1052,1056,1061,1065,1070,1074,1079,1083,1088,1092,1097],{"type":606,"tag":636,"props":1004,"children":1005},{"style":659},[1006],{"type":612,"value":1007},"    print",{"type":606,"tag":636,"props":1009,"children":1010},{"style":648},[1011],{"type":612,"value":1012},"(",{"type":606,"tag":636,"props":1014,"children":1015},{"style":642},[1016],{"type":612,"value":1017},"f",{"type":606,"tag":636,"props":1019,"children":1020},{"style":695},[1021],{"type":612,"value":1022},"\"Book ",{"type":606,"tag":636,"props":1024,"children":1025},{"style":659},[1026],{"type":612,"value":1027},"{",{"type":606,"tag":636,"props":1029,"children":1030},{"style":648},[1031],{"type":612,"value":1032},"book_id",{"type":606,"tag":636,"props":1034,"children":1035},{"style":659},[1036],{"type":612,"value":1037},"}",{"type":606,"tag":636,"props":1039,"children":1040},{"style":695},[1041],{"type":612,"value":1042},": ",{"type":606,"tag":636,"props":1044,"children":1045},{"style":659},[1046],{"type":612,"value":1027},{"type":606,"tag":636,"props":1048,"children":1049},{"style":648},[1050],{"type":612,"value":1051},"title",{"type":606,"tag":636,"props":1053,"children":1054},{"style":659},[1055],{"type":612,"value":1037},{"type":606,"tag":636,"props":1057,"children":1058},{"style":695},[1059],{"type":612,"value":1060}," by ",{"type":606,"tag":636,"props":1062,"children":1063},{"style":659},[1064],{"type":612,"value":1027},{"type":606,"tag":636,"props":1066,"children":1067},{"style":648},[1068],{"type":612,"value":1069},"author",{"type":606,"tag":636,"props":1071,"children":1072},{"style":659},[1073],{"type":612,"value":1037},{"type":606,"tag":636,"props":1075,"children":1076},{"style":695},[1077],{"type":612,"value":1078}," - $",{"type":606,"tag":636,"props":1080,"children":1081},{"style":659},[1082],{"type":612,"value":1027},{"type":606,"tag":636,"props":1084,"children":1085},{"style":648},[1086],{"type":612,"value":1087},"price",{"type":606,"tag":636,"props":1089,"children":1090},{"style":659},[1091],{"type":612,"value":1037},{"type":606,"tag":636,"props":1093,"children":1094},{"style":695},[1095],{"type":612,"value":1096},"\"",{"type":606,"tag":636,"props":1098,"children":1099},{"style":648},[1100],{"type":612,"value":914},{"type":606,"tag":1102,"props":1103,"children":1105},"h2",{"id":1104},"understanding-xml-and-html-parsing",[1106],{"type":612,"value":1107},"🎯 Understanding XML and HTML Parsing",{"type":606,"tag":615,"props":1109,"children":1110},{},[1111],{"type":612,"value":1112},"XML and HTML have tree-like structures that can be navigated to extract specific data elements.",{"type":606,"tag":1114,"props":1115,"children":1119},"info-box",{"emoji":1116,"title":1117,"type":1118},"🌳","Parsing Basics","info",[1120,1129,1154,1162,1185,1193],{"type":606,"tag":615,"props":1121,"children":1122},{},[1123],{"type":606,"tag":1124,"props":1125,"children":1126},"strong",{},[1127],{"type":612,"value":1128},"XML (eXtensible Markup Language):",{"type":606,"tag":1130,"props":1131,"children":1132},"ul",{},[1133,1139,1144,1149],{"type":606,"tag":1134,"props":1135,"children":1136},"li",{},[1137],{"type":612,"value":1138},"Structured data format",{"type":606,"tag":1134,"props":1140,"children":1141},{},[1142],{"type":612,"value":1143},"Custom tags and attributes",{"type":606,"tag":1134,"props":1145,"children":1146},{},[1147],{"type":612,"value":1148},"Used for data storage and exchange",{"type":606,"tag":1134,"props":1150,"children":1151},{},[1152],{"type":612,"value":1153},"Strict syntax rules",{"type":606,"tag":615,"props":1155,"children":1156},{},[1157],{"type":606,"tag":1124,"props":1158,"children":1159},{},[1160],{"type":612,"value":1161},"HTML (HyperText Markup Language):",{"type":606,"tag":1130,"props":1163,"children":1164},{},[1165,1170,1175,1180],{"type":606,"tag":1134,"props":1166,"children":1167},{},[1168],{"type":612,"value":1169},"Web page markup language",{"type":606,"tag":1134,"props":1171,"children":1172},{},[1173],{"type":612,"value":1174},"Predefined tags (div, p, a, etc.)",{"type":606,"tag":1134,"props":1176,"children":1177},{},[1178],{"type":612,"value":1179},"Less strict than XML",{"type":606,"tag":1134,"props":1181,"children":1182},{},[1183],{"type":612,"value":1184},"Contains text content and structure",{"type":606,"tag":615,"props":1186,"children":1187},{},[1188],{"type":606,"tag":1124,"props":1189,"children":1190},{},[1191],{"type":612,"value":1192},"Python Tools:",{"type":606,"tag":1130,"props":1194,"children":1195},{},[1196,1207,1218],{"type":606,"tag":1134,"props":1197,"children":1198},{},[1199,1205],{"type":606,"tag":632,"props":1200,"children":1202},{"className":1201},[],[1203],{"type":612,"value":1204},"xml.etree.ElementTree",{"type":612,"value":1206}," - Built-in XML parser",{"type":606,"tag":1134,"props":1208,"children":1209},{},[1210,1216],{"type":606,"tag":632,"props":1211,"children":1213},{"className":1212},[],[1214],{"type":612,"value":1215},"html.parser",{"type":612,"value":1217}," - Built-in HTML parser",{"type":606,"tag":1134,"props":1219,"children":1220},{},[1221,1223,1229,1231,1237],{"type":612,"value":1222},"Third-party: ",{"type":606,"tag":632,"props":1224,"children":1226},{"className":1225},[],[1227],{"type":612,"value":1228},"BeautifulSoup",{"type":612,"value":1230},", ",{"type":606,"tag":632,"props":1232,"children":1234},{"className":1233},[],[1235],{"type":612,"value":1236},"lxml",{"type":612,"value":1238}," (more features)",{"type":606,"tag":1240,"props":1241,"children":1243},"h3",{"id":1242},"basic-xml-parsing",[1244],{"type":612,"value":1245},"Basic XML Parsing",{"type":606,"tag":621,"props":1247,"children":1248},{},[1249],{"type":606,"tag":625,"props":1250,"children":1252},{"className":627,"code":1251,"language":629,"meta":8,"style":8},"import xml.etree.ElementTree as ET\n\n# XML configuration example\nconfig_xml = \"\"\"\n\u003Cconfig>\n    \u003Cdatabase>\n        \u003Chost>localhost\u003C/host>\n        \u003Cport>5432\u003C/port>\n        \u003Cname>myapp\u003C/name>\n    \u003C/database>\n    \u003Csettings>\n        \u003Cdebug>true\u003C/debug>\n        \u003Ctimeout>30\u003C/timeout>\n    \u003C/settings>\n\u003C/config>\n\"\"\"\n\n# Parse and extract configuration\nroot = ET.fromstring(config_xml)\n\n# Get database settings\ndb_host = root.find('database/host').text\ndb_port = int(root.find('database/port').text)\ndb_name = root.find('database/name').text\n\n# Get application settings\ndebug_mode = root.find('settings/debug').text == 'true'\ntimeout = int(root.find('settings/timeout').text)\n\nprint(f\"Database: {db_host}:{db_port}/{db_name}\")\nprint(f\"Debug: {debug_mode}, Timeout: {timeout}s\")\n",[1253],{"type":606,"tag":632,"props":1254,"children":1255},{"__ignoreMap":8},[1256,1275,1282,1290,1306,1314,1322,1330,1338,1346,1354,1362,1370,1378,1386,1394,1401,1408,1416,1436,1443,1451,1477,1509,1534,1541,1549,1585,1614,1621,1699],{"type":606,"tag":636,"props":1257,"children":1258},{"class":638,"line":12},[1259,1263,1267,1271],{"type":606,"tag":636,"props":1260,"children":1261},{"style":642},[1262],{"type":612,"value":645},{"type":606,"tag":636,"props":1264,"children":1265},{"style":648},[1266],{"type":612,"value":651},{"type":606,"tag":636,"props":1268,"children":1269},{"style":642},[1270],{"type":612,"value":656},{"type":606,"tag":636,"props":1272,"children":1273},{"style":659},[1274],{"type":612,"value":662},{"type":606,"tag":636,"props":1276,"children":1277},{"class":638,"line":27},[1278],{"type":606,"tag":636,"props":1279,"children":1280},{"emptyLinePlaceholder":13},[1281],{"type":612,"value":670},{"type":606,"tag":636,"props":1283,"children":1284},{"class":638,"line":36},[1285],{"type":606,"tag":636,"props":1286,"children":1287},{"style":676},[1288],{"type":612,"value":1289},"# XML configuration example\n",{"type":606,"tag":636,"props":1291,"children":1292},{"class":638,"line":45},[1293,1298,1302],{"type":606,"tag":636,"props":1294,"children":1295},{"style":648},[1296],{"type":612,"value":1297},"config_xml ",{"type":606,"tag":636,"props":1299,"children":1300},{"style":642},[1301],{"type":612,"value":692},{"type":606,"tag":636,"props":1303,"children":1304},{"style":695},[1305],{"type":612,"value":698},{"type":606,"tag":636,"props":1307,"children":1308},{"class":638,"line":54},[1309],{"type":606,"tag":636,"props":1310,"children":1311},{"style":695},[1312],{"type":612,"value":1313},"\u003Cconfig>\n",{"type":606,"tag":636,"props":1315,"children":1316},{"class":638,"line":63},[1317],{"type":606,"tag":636,"props":1318,"children":1319},{"style":695},[1320],{"type":612,"value":1321},"    \u003Cdatabase>\n",{"type":606,"tag":636,"props":1323,"children":1324},{"class":638,"line":72},[1325],{"type":606,"tag":636,"props":1326,"children":1327},{"style":695},[1328],{"type":612,"value":1329},"        \u003Chost>localhost\u003C/host>\n",{"type":606,"tag":636,"props":1331,"children":1332},{"class":638,"line":81},[1333],{"type":606,"tag":636,"props":1334,"children":1335},{"style":695},[1336],{"type":612,"value":1337},"        \u003Cport>5432\u003C/port>\n",{"type":606,"tag":636,"props":1339,"children":1340},{"class":638,"line":733},[1341],{"type":606,"tag":636,"props":1342,"children":1343},{"style":695},[1344],{"type":612,"value":1345},"        \u003Cname>myapp\u003C/name>\n",{"type":606,"tag":636,"props":1347,"children":1348},{"class":638,"line":99},[1349],{"type":606,"tag":636,"props":1350,"children":1351},{"style":695},[1352],{"type":612,"value":1353},"    \u003C/database>\n",{"type":606,"tag":636,"props":1355,"children":1356},{"class":638,"line":108},[1357],{"type":606,"tag":636,"props":1358,"children":1359},{"style":695},[1360],{"type":612,"value":1361},"    \u003Csettings>\n",{"type":606,"tag":636,"props":1363,"children":1364},{"class":638,"line":117},[1365],{"type":606,"tag":636,"props":1366,"children":1367},{"style":695},[1368],{"type":612,"value":1369},"        \u003Cdebug>true\u003C/debug>\n",{"type":606,"tag":636,"props":1371,"children":1372},{"class":638,"line":126},[1373],{"type":606,"tag":636,"props":1374,"children":1375},{"style":695},[1376],{"type":612,"value":1377},"        \u003Ctimeout>30\u003C/timeout>\n",{"type":606,"tag":636,"props":1379,"children":1380},{"class":638,"line":135},[1381],{"type":606,"tag":636,"props":1382,"children":1383},{"style":695},[1384],{"type":612,"value":1385},"    \u003C/settings>\n",{"type":606,"tag":636,"props":1387,"children":1388},{"class":638,"line":144},[1389],{"type":606,"tag":636,"props":1390,"children":1391},{"style":695},[1392],{"type":612,"value":1393},"\u003C/config>\n",{"type":606,"tag":636,"props":1395,"children":1396},{"class":638,"line":153},[1397],{"type":606,"tag":636,"props":1398,"children":1399},{"style":695},[1400],{"type":612,"value":802},{"type":606,"tag":636,"props":1402,"children":1403},{"class":638,"line":163},[1404],{"type":606,"tag":636,"props":1405,"children":1406},{"emptyLinePlaceholder":13},[1407],{"type":612,"value":670},{"type":606,"tag":636,"props":1409,"children":1410},{"class":638,"line":172},[1411],{"type":606,"tag":636,"props":1412,"children":1413},{"style":676},[1414],{"type":612,"value":1415},"# Parse and extract configuration\n",{"type":606,"tag":636,"props":1417,"children":1418},{"class":638,"line":181},[1419,1423,1427,1431],{"type":606,"tag":636,"props":1420,"children":1421},{"style":648},[1422],{"type":612,"value":825},{"type":606,"tag":636,"props":1424,"children":1425},{"style":642},[1426],{"type":612,"value":692},{"type":606,"tag":636,"props":1428,"children":1429},{"style":659},[1430],{"type":612,"value":834},{"type":606,"tag":636,"props":1432,"children":1433},{"style":648},[1434],{"type":612,"value":1435},".fromstring(config_xml)\n",{"type":606,"tag":636,"props":1437,"children":1438},{"class":638,"line":190},[1439],{"type":606,"tag":636,"props":1440,"children":1441},{"emptyLinePlaceholder":13},[1442],{"type":612,"value":670},{"type":606,"tag":636,"props":1444,"children":1445},{"class":638,"line":199},[1446],{"type":606,"tag":636,"props":1447,"children":1448},{"style":676},[1449],{"type":612,"value":1450},"# Get database settings\n",{"type":606,"tag":636,"props":1452,"children":1453},{"class":638,"line":208},[1454,1459,1463,1468,1473],{"type":606,"tag":636,"props":1455,"children":1456},{"style":648},[1457],{"type":612,"value":1458},"db_host ",{"type":606,"tag":636,"props":1460,"children":1461},{"style":642},[1462],{"type":612,"value":692},{"type":606,"tag":636,"props":1464,"children":1465},{"style":648},[1466],{"type":612,"value":1467}," root.find(",{"type":606,"tag":636,"props":1469,"children":1470},{"style":695},[1471],{"type":612,"value":1472},"'database/host'",{"type":606,"tag":636,"props":1474,"children":1475},{"style":648},[1476],{"type":612,"value":941},{"type":606,"tag":636,"props":1478,"children":1479},{"class":638,"line":217},[1480,1485,1489,1494,1499,1504],{"type":606,"tag":636,"props":1481,"children":1482},{"style":648},[1483],{"type":612,"value":1484},"db_port ",{"type":606,"tag":636,"props":1486,"children":1487},{"style":642},[1488],{"type":612,"value":692},{"type":606,"tag":636,"props":1490,"children":1491},{"style":659},[1492],{"type":612,"value":1493}," int",{"type":606,"tag":636,"props":1495,"children":1496},{"style":648},[1497],{"type":612,"value":1498},"(root.find(",{"type":606,"tag":636,"props":1500,"children":1501},{"style":695},[1502],{"type":612,"value":1503},"'database/port'",{"type":606,"tag":636,"props":1505,"children":1506},{"style":648},[1507],{"type":612,"value":1508},").text)\n",{"type":606,"tag":636,"props":1510,"children":1511},{"class":638,"line":227},[1512,1517,1521,1525,1530],{"type":606,"tag":636,"props":1513,"children":1514},{"style":648},[1515],{"type":612,"value":1516},"db_name ",{"type":606,"tag":636,"props":1518,"children":1519},{"style":642},[1520],{"type":612,"value":692},{"type":606,"tag":636,"props":1522,"children":1523},{"style":648},[1524],{"type":612,"value":1467},{"type":606,"tag":636,"props":1526,"children":1527},{"style":695},[1528],{"type":612,"value":1529},"'database/name'",{"type":606,"tag":636,"props":1531,"children":1532},{"style":648},[1533],{"type":612,"value":941},{"type":606,"tag":636,"props":1535,"children":1536},{"class":638,"line":236},[1537],{"type":606,"tag":636,"props":1538,"children":1539},{"emptyLinePlaceholder":13},[1540],{"type":612,"value":670},{"type":606,"tag":636,"props":1542,"children":1543},{"class":638,"line":245},[1544],{"type":606,"tag":636,"props":1545,"children":1546},{"style":676},[1547],{"type":612,"value":1548},"# Get application settings\n",{"type":606,"tag":636,"props":1550,"children":1551},{"class":638,"line":254},[1552,1557,1561,1565,1570,1575,1580],{"type":606,"tag":636,"props":1553,"children":1554},{"style":648},[1555],{"type":612,"value":1556},"debug_mode ",{"type":606,"tag":636,"props":1558,"children":1559},{"style":642},[1560],{"type":612,"value":692},{"type":606,"tag":636,"props":1562,"children":1563},{"style":648},[1564],{"type":612,"value":1467},{"type":606,"tag":636,"props":1566,"children":1567},{"style":695},[1568],{"type":612,"value":1569},"'settings/debug'",{"type":606,"tag":636,"props":1571,"children":1572},{"style":648},[1573],{"type":612,"value":1574},").text ",{"type":606,"tag":636,"props":1576,"children":1577},{"style":642},[1578],{"type":612,"value":1579},"==",{"type":606,"tag":636,"props":1581,"children":1582},{"style":695},[1583],{"type":612,"value":1584}," 'true'\n",{"type":606,"tag":636,"props":1586,"children":1587},{"class":638,"line":263},[1588,1593,1597,1601,1605,1610],{"type":606,"tag":636,"props":1589,"children":1590},{"style":648},[1591],{"type":612,"value":1592},"timeout ",{"type":606,"tag":636,"props":1594,"children":1595},{"style":642},[1596],{"type":612,"value":692},{"type":606,"tag":636,"props":1598,"children":1599},{"style":659},[1600],{"type":612,"value":1493},{"type":606,"tag":636,"props":1602,"children":1603},{"style":648},[1604],{"type":612,"value":1498},{"type":606,"tag":636,"props":1606,"children":1607},{"style":695},[1608],{"type":612,"value":1609},"'settings/timeout'",{"type":606,"tag":636,"props":1611,"children":1612},{"style":648},[1613],{"type":612,"value":1508},{"type":606,"tag":636,"props":1615,"children":1616},{"class":638,"line":272},[1617],{"type":606,"tag":636,"props":1618,"children":1619},{"emptyLinePlaceholder":13},[1620],{"type":612,"value":670},{"type":606,"tag":636,"props":1622,"children":1623},{"class":638,"line":281},[1624,1629,1633,1637,1642,1646,1651,1655,1660,1664,1669,1673,1678,1682,1687,1691,1695],{"type":606,"tag":636,"props":1625,"children":1626},{"style":659},[1627],{"type":612,"value":1628},"print",{"type":606,"tag":636,"props":1630,"children":1631},{"style":648},[1632],{"type":612,"value":1012},{"type":606,"tag":636,"props":1634,"children":1635},{"style":642},[1636],{"type":612,"value":1017},{"type":606,"tag":636,"props":1638,"children":1639},{"style":695},[1640],{"type":612,"value":1641},"\"Database: ",{"type":606,"tag":636,"props":1643,"children":1644},{"style":659},[1645],{"type":612,"value":1027},{"type":606,"tag":636,"props":1647,"children":1648},{"style":648},[1649],{"type":612,"value":1650},"db_host",{"type":606,"tag":636,"props":1652,"children":1653},{"style":659},[1654],{"type":612,"value":1037},{"type":606,"tag":636,"props":1656,"children":1657},{"style":695},[1658],{"type":612,"value":1659},":",{"type":606,"tag":636,"props":1661,"children":1662},{"style":659},[1663],{"type":612,"value":1027},{"type":606,"tag":636,"props":1665,"children":1666},{"style":648},[1667],{"type":612,"value":1668},"db_port",{"type":606,"tag":636,"props":1670,"children":1671},{"style":659},[1672],{"type":612,"value":1037},{"type":606,"tag":636,"props":1674,"children":1675},{"style":695},[1676],{"type":612,"value":1677},"/",{"type":606,"tag":636,"props":1679,"children":1680},{"style":659},[1681],{"type":612,"value":1027},{"type":606,"tag":636,"props":1683,"children":1684},{"style":648},[1685],{"type":612,"value":1686},"db_name",{"type":606,"tag":636,"props":1688,"children":1689},{"style":659},[1690],{"type":612,"value":1037},{"type":606,"tag":636,"props":1692,"children":1693},{"style":695},[1694],{"type":612,"value":1096},{"type":606,"tag":636,"props":1696,"children":1697},{"style":648},[1698],{"type":612,"value":914},{"type":606,"tag":636,"props":1700,"children":1701},{"class":638,"line":291},[1702,1706,1710,1714,1719,1723,1728,1732,1737,1741,1746,1750,1755],{"type":606,"tag":636,"props":1703,"children":1704},{"style":659},[1705],{"type":612,"value":1628},{"type":606,"tag":636,"props":1707,"children":1708},{"style":648},[1709],{"type":612,"value":1012},{"type":606,"tag":636,"props":1711,"children":1712},{"style":642},[1713],{"type":612,"value":1017},{"type":606,"tag":636,"props":1715,"children":1716},{"style":695},[1717],{"type":612,"value":1718},"\"Debug: ",{"type":606,"tag":636,"props":1720,"children":1721},{"style":659},[1722],{"type":612,"value":1027},{"type":606,"tag":636,"props":1724,"children":1725},{"style":648},[1726],{"type":612,"value":1727},"debug_mode",{"type":606,"tag":636,"props":1729,"children":1730},{"style":659},[1731],{"type":612,"value":1037},{"type":606,"tag":636,"props":1733,"children":1734},{"style":695},[1735],{"type":612,"value":1736},", Timeout: ",{"type":606,"tag":636,"props":1738,"children":1739},{"style":659},[1740],{"type":612,"value":1027},{"type":606,"tag":636,"props":1742,"children":1743},{"style":648},[1744],{"type":612,"value":1745},"timeout",{"type":606,"tag":636,"props":1747,"children":1748},{"style":659},[1749],{"type":612,"value":1037},{"type":606,"tag":636,"props":1751,"children":1752},{"style":695},[1753],{"type":612,"value":1754},"s\"",{"type":606,"tag":636,"props":1756,"children":1757},{"style":648},[1758],{"type":612,"value":914},{"type":606,"tag":1240,"props":1760,"children":1762},{"id":1761},"working-with-xml-attributes",[1763],{"type":612,"value":1764},"Working with XML Attributes",{"type":606,"tag":621,"props":1766,"children":1767},{},[1768],{"type":606,"tag":625,"props":1769,"children":1771},{"className":627,"code":1770,"language":629,"meta":8,"style":8},"import xml.etree.ElementTree as ET\n\n# XML with attributes\nproducts_xml = \"\"\"\n\u003Ccatalog>\n    \u003Cproduct id=\"101\" category=\"electronics\">\n        \u003Cname>Laptop\u003C/name>\n        \u003Cprice currency=\"USD\">999.99\u003C/price>\n        \u003Cstock>5\u003C/stock>\n    \u003C/product>\n    \u003Cproduct id=\"102\" category=\"books\">\n        \u003Cname>Python Guide\u003C/name>\n        \u003Cprice currency=\"USD\">39.99\u003C/price>\n        \u003Cstock>20\u003C/stock>\n    \u003C/product>\n\u003C/catalog>\n\"\"\"\n\nroot = ET.fromstring(products_xml)\n\n# Process products with attributes\nfor product in root.findall('product'):\n    # Get attributes\n    product_id = product.get('id')\n    category = product.get('category')\n    \n    # Get element text\n    name = product.find('name').text\n    price_element = product.find('price')\n    price = float(price_element.text)\n    currency = price_element.get('currency')\n    stock = int(product.find('stock').text)\n    \n    print(f\"Product {product_id} ({category}):\")\n    print(f\"  {name}: {price} {currency} (Stock: {stock})\")\n",[1772],{"type":606,"tag":632,"props":1773,"children":1774},{"__ignoreMap":8},[1775,1794,1801,1809,1825,1833,1841,1849,1857,1865,1873,1881,1889,1897,1905,1912,1920,1927,1934,1954,1961,1969,1998,2006,2031,2056,2063,2071,2097,2121,2142,2168,2198,2205,2265],{"type":606,"tag":636,"props":1776,"children":1777},{"class":638,"line":12},[1778,1782,1786,1790],{"type":606,"tag":636,"props":1779,"children":1780},{"style":642},[1781],{"type":612,"value":645},{"type":606,"tag":636,"props":1783,"children":1784},{"style":648},[1785],{"type":612,"value":651},{"type":606,"tag":636,"props":1787,"children":1788},{"style":642},[1789],{"type":612,"value":656},{"type":606,"tag":636,"props":1791,"children":1792},{"style":659},[1793],{"type":612,"value":662},{"type":606,"tag":636,"props":1795,"children":1796},{"class":638,"line":27},[1797],{"type":606,"tag":636,"props":1798,"children":1799},{"emptyLinePlaceholder":13},[1800],{"type":612,"value":670},{"type":606,"tag":636,"props":1802,"children":1803},{"class":638,"line":36},[1804],{"type":606,"tag":636,"props":1805,"children":1806},{"style":676},[1807],{"type":612,"value":1808},"# XML with attributes\n",{"type":606,"tag":636,"props":1810,"children":1811},{"class":638,"line":45},[1812,1817,1821],{"type":606,"tag":636,"props":1813,"children":1814},{"style":648},[1815],{"type":612,"value":1816},"products_xml ",{"type":606,"tag":636,"props":1818,"children":1819},{"style":642},[1820],{"type":612,"value":692},{"type":606,"tag":636,"props":1822,"children":1823},{"style":695},[1824],{"type":612,"value":698},{"type":606,"tag":636,"props":1826,"children":1827},{"class":638,"line":54},[1828],{"type":606,"tag":636,"props":1829,"children":1830},{"style":695},[1831],{"type":612,"value":1832},"\u003Ccatalog>\n",{"type":606,"tag":636,"props":1834,"children":1835},{"class":638,"line":63},[1836],{"type":606,"tag":636,"props":1837,"children":1838},{"style":695},[1839],{"type":612,"value":1840},"    \u003Cproduct id=\"101\" category=\"electronics\">\n",{"type":606,"tag":636,"props":1842,"children":1843},{"class":638,"line":72},[1844],{"type":606,"tag":636,"props":1845,"children":1846},{"style":695},[1847],{"type":612,"value":1848},"        \u003Cname>Laptop\u003C/name>\n",{"type":606,"tag":636,"props":1850,"children":1851},{"class":638,"line":81},[1852],{"type":606,"tag":636,"props":1853,"children":1854},{"style":695},[1855],{"type":612,"value":1856},"        \u003Cprice currency=\"USD\">999.99\u003C/price>\n",{"type":606,"tag":636,"props":1858,"children":1859},{"class":638,"line":733},[1860],{"type":606,"tag":636,"props":1861,"children":1862},{"style":695},[1863],{"type":612,"value":1864},"        \u003Cstock>5\u003C/stock>\n",{"type":606,"tag":636,"props":1866,"children":1867},{"class":638,"line":99},[1868],{"type":606,"tag":636,"props":1869,"children":1870},{"style":695},[1871],{"type":612,"value":1872},"    \u003C/product>\n",{"type":606,"tag":636,"props":1874,"children":1875},{"class":638,"line":108},[1876],{"type":606,"tag":636,"props":1877,"children":1878},{"style":695},[1879],{"type":612,"value":1880},"    \u003Cproduct id=\"102\" category=\"books\">\n",{"type":606,"tag":636,"props":1882,"children":1883},{"class":638,"line":117},[1884],{"type":606,"tag":636,"props":1885,"children":1886},{"style":695},[1887],{"type":612,"value":1888},"        \u003Cname>Python Guide\u003C/name>\n",{"type":606,"tag":636,"props":1890,"children":1891},{"class":638,"line":126},[1892],{"type":606,"tag":636,"props":1893,"children":1894},{"style":695},[1895],{"type":612,"value":1896},"        \u003Cprice currency=\"USD\">39.99\u003C/price>\n",{"type":606,"tag":636,"props":1898,"children":1899},{"class":638,"line":135},[1900],{"type":606,"tag":636,"props":1901,"children":1902},{"style":695},[1903],{"type":612,"value":1904},"        \u003Cstock>20\u003C/stock>\n",{"type":606,"tag":636,"props":1906,"children":1907},{"class":638,"line":144},[1908],{"type":606,"tag":636,"props":1909,"children":1910},{"style":695},[1911],{"type":612,"value":1872},{"type":606,"tag":636,"props":1913,"children":1914},{"class":638,"line":153},[1915],{"type":606,"tag":636,"props":1916,"children":1917},{"style":695},[1918],{"type":612,"value":1919},"\u003C/catalog>\n",{"type":606,"tag":636,"props":1921,"children":1922},{"class":638,"line":163},[1923],{"type":606,"tag":636,"props":1924,"children":1925},{"style":695},[1926],{"type":612,"value":802},{"type":606,"tag":636,"props":1928,"children":1929},{"class":638,"line":172},[1930],{"type":606,"tag":636,"props":1931,"children":1932},{"emptyLinePlaceholder":13},[1933],{"type":612,"value":670},{"type":606,"tag":636,"props":1935,"children":1936},{"class":638,"line":181},[1937,1941,1945,1949],{"type":606,"tag":636,"props":1938,"children":1939},{"style":648},[1940],{"type":612,"value":825},{"type":606,"tag":636,"props":1942,"children":1943},{"style":642},[1944],{"type":612,"value":692},{"type":606,"tag":636,"props":1946,"children":1947},{"style":659},[1948],{"type":612,"value":834},{"type":606,"tag":636,"props":1950,"children":1951},{"style":648},[1952],{"type":612,"value":1953},".fromstring(products_xml)\n",{"type":606,"tag":636,"props":1955,"children":1956},{"class":638,"line":190},[1957],{"type":606,"tag":636,"props":1958,"children":1959},{"emptyLinePlaceholder":13},[1960],{"type":612,"value":670},{"type":606,"tag":636,"props":1962,"children":1963},{"class":638,"line":199},[1964],{"type":606,"tag":636,"props":1965,"children":1966},{"style":676},[1967],{"type":612,"value":1968},"# Process products with attributes\n",{"type":606,"tag":636,"props":1970,"children":1971},{"class":638,"line":208},[1972,1976,1981,1985,1989,1994],{"type":606,"tag":636,"props":1973,"children":1974},{"style":642},[1975],{"type":612,"value":862},{"type":606,"tag":636,"props":1977,"children":1978},{"style":648},[1979],{"type":612,"value":1980}," product ",{"type":606,"tag":636,"props":1982,"children":1983},{"style":642},[1984],{"type":612,"value":872},{"type":606,"tag":636,"props":1986,"children":1987},{"style":648},[1988],{"type":612,"value":877},{"type":606,"tag":636,"props":1990,"children":1991},{"style":695},[1992],{"type":612,"value":1993},"'product'",{"type":606,"tag":636,"props":1995,"children":1996},{"style":648},[1997],{"type":612,"value":887},{"type":606,"tag":636,"props":1999,"children":2000},{"class":638,"line":217},[2001],{"type":606,"tag":636,"props":2002,"children":2003},{"style":676},[2004],{"type":612,"value":2005},"    # Get attributes\n",{"type":606,"tag":636,"props":2007,"children":2008},{"class":638,"line":227},[2009,2014,2018,2023,2027],{"type":606,"tag":636,"props":2010,"children":2011},{"style":648},[2012],{"type":612,"value":2013},"    product_id ",{"type":606,"tag":636,"props":2015,"children":2016},{"style":642},[2017],{"type":612,"value":692},{"type":606,"tag":636,"props":2019,"children":2020},{"style":648},[2021],{"type":612,"value":2022}," product.get(",{"type":606,"tag":636,"props":2024,"children":2025},{"style":695},[2026],{"type":612,"value":909},{"type":606,"tag":636,"props":2028,"children":2029},{"style":648},[2030],{"type":612,"value":914},{"type":606,"tag":636,"props":2032,"children":2033},{"class":638,"line":236},[2034,2039,2043,2047,2052],{"type":606,"tag":636,"props":2035,"children":2036},{"style":648},[2037],{"type":612,"value":2038},"    category ",{"type":606,"tag":636,"props":2040,"children":2041},{"style":642},[2042],{"type":612,"value":692},{"type":606,"tag":636,"props":2044,"children":2045},{"style":648},[2046],{"type":612,"value":2022},{"type":606,"tag":636,"props":2048,"children":2049},{"style":695},[2050],{"type":612,"value":2051},"'category'",{"type":606,"tag":636,"props":2053,"children":2054},{"style":648},[2055],{"type":612,"value":914},{"type":606,"tag":636,"props":2057,"children":2058},{"class":638,"line":245},[2059],{"type":606,"tag":636,"props":2060,"children":2061},{"style":648},[2062],{"type":612,"value":999},{"type":606,"tag":636,"props":2064,"children":2065},{"class":638,"line":254},[2066],{"type":606,"tag":636,"props":2067,"children":2068},{"style":676},[2069],{"type":612,"value":2070},"    # Get element text\n",{"type":606,"tag":636,"props":2072,"children":2073},{"class":638,"line":263},[2074,2079,2083,2088,2093],{"type":606,"tag":636,"props":2075,"children":2076},{"style":648},[2077],{"type":612,"value":2078},"    name ",{"type":606,"tag":636,"props":2080,"children":2081},{"style":642},[2082],{"type":612,"value":692},{"type":606,"tag":636,"props":2084,"children":2085},{"style":648},[2086],{"type":612,"value":2087}," product.find(",{"type":606,"tag":636,"props":2089,"children":2090},{"style":695},[2091],{"type":612,"value":2092},"'name'",{"type":606,"tag":636,"props":2094,"children":2095},{"style":648},[2096],{"type":612,"value":941},{"type":606,"tag":636,"props":2098,"children":2099},{"class":638,"line":272},[2100,2105,2109,2113,2117],{"type":606,"tag":636,"props":2101,"children":2102},{"style":648},[2103],{"type":612,"value":2104},"    price_element ",{"type":606,"tag":636,"props":2106,"children":2107},{"style":642},[2108],{"type":612,"value":692},{"type":606,"tag":636,"props":2110,"children":2111},{"style":648},[2112],{"type":612,"value":2087},{"type":606,"tag":636,"props":2114,"children":2115},{"style":695},[2116],{"type":612,"value":987},{"type":606,"tag":636,"props":2118,"children":2119},{"style":648},[2120],{"type":612,"value":914},{"type":606,"tag":636,"props":2122,"children":2123},{"class":638,"line":281},[2124,2128,2132,2137],{"type":606,"tag":636,"props":2125,"children":2126},{"style":648},[2127],{"type":612,"value":974},{"type":606,"tag":636,"props":2129,"children":2130},{"style":642},[2131],{"type":612,"value":692},{"type":606,"tag":636,"props":2133,"children":2134},{"style":659},[2135],{"type":612,"value":2136}," float",{"type":606,"tag":636,"props":2138,"children":2139},{"style":648},[2140],{"type":612,"value":2141},"(price_element.text)\n",{"type":606,"tag":636,"props":2143,"children":2144},{"class":638,"line":291},[2145,2150,2154,2159,2164],{"type":606,"tag":636,"props":2146,"children":2147},{"style":648},[2148],{"type":612,"value":2149},"    currency ",{"type":606,"tag":636,"props":2151,"children":2152},{"style":642},[2153],{"type":612,"value":692},{"type":606,"tag":636,"props":2155,"children":2156},{"style":648},[2157],{"type":612,"value":2158}," price_element.get(",{"type":606,"tag":636,"props":2160,"children":2161},{"style":695},[2162],{"type":612,"value":2163},"'currency'",{"type":606,"tag":636,"props":2165,"children":2166},{"style":648},[2167],{"type":612,"value":914},{"type":606,"tag":636,"props":2169,"children":2170},{"class":638,"line":302},[2171,2176,2180,2184,2189,2194],{"type":606,"tag":636,"props":2172,"children":2173},{"style":648},[2174],{"type":612,"value":2175},"    stock ",{"type":606,"tag":636,"props":2177,"children":2178},{"style":642},[2179],{"type":612,"value":692},{"type":606,"tag":636,"props":2181,"children":2182},{"style":659},[2183],{"type":612,"value":1493},{"type":606,"tag":636,"props":2185,"children":2186},{"style":648},[2187],{"type":612,"value":2188},"(product.find(",{"type":606,"tag":636,"props":2190,"children":2191},{"style":695},[2192],{"type":612,"value":2193},"'stock'",{"type":606,"tag":636,"props":2195,"children":2196},{"style":648},[2197],{"type":612,"value":1508},{"type":606,"tag":636,"props":2199,"children":2200},{"class":638,"line":311},[2201],{"type":606,"tag":636,"props":2202,"children":2203},{"style":648},[2204],{"type":612,"value":999},{"type":606,"tag":636,"props":2206,"children":2207},{"class":638,"line":320},[2208,2212,2216,2220,2225,2229,2234,2238,2243,2247,2252,2256,2261],{"type":606,"tag":636,"props":2209,"children":2210},{"style":659},[2211],{"type":612,"value":1007},{"type":606,"tag":636,"props":2213,"children":2214},{"style":648},[2215],{"type":612,"value":1012},{"type":606,"tag":636,"props":2217,"children":2218},{"style":642},[2219],{"type":612,"value":1017},{"type":606,"tag":636,"props":2221,"children":2222},{"style":695},[2223],{"type":612,"value":2224},"\"Product ",{"type":606,"tag":636,"props":2226,"children":2227},{"style":659},[2228],{"type":612,"value":1027},{"type":606,"tag":636,"props":2230,"children":2231},{"style":648},[2232],{"type":612,"value":2233},"product_id",{"type":606,"tag":636,"props":2235,"children":2236},{"style":659},[2237],{"type":612,"value":1037},{"type":606,"tag":636,"props":2239,"children":2240},{"style":695},[2241],{"type":612,"value":2242}," (",{"type":606,"tag":636,"props":2244,"children":2245},{"style":659},[2246],{"type":612,"value":1027},{"type":606,"tag":636,"props":2248,"children":2249},{"style":648},[2250],{"type":612,"value":2251},"category",{"type":606,"tag":636,"props":2253,"children":2254},{"style":659},[2255],{"type":612,"value":1037},{"type":606,"tag":636,"props":2257,"children":2258},{"style":695},[2259],{"type":612,"value":2260},"):\"",{"type":606,"tag":636,"props":2262,"children":2263},{"style":648},[2264],{"type":612,"value":914},{"type":606,"tag":636,"props":2266,"children":2267},{"class":638,"line":329},[2268,2272,2276,2280,2285,2289,2294,2298,2302,2306,2310,2314,2319,2324,2328,2333,2337,2342,2346,2351],{"type":606,"tag":636,"props":2269,"children":2270},{"style":659},[2271],{"type":612,"value":1007},{"type":606,"tag":636,"props":2273,"children":2274},{"style":648},[2275],{"type":612,"value":1012},{"type":606,"tag":636,"props":2277,"children":2278},{"style":642},[2279],{"type":612,"value":1017},{"type":606,"tag":636,"props":2281,"children":2282},{"style":695},[2283],{"type":612,"value":2284},"\"  ",{"type":606,"tag":636,"props":2286,"children":2287},{"style":659},[2288],{"type":612,"value":1027},{"type":606,"tag":636,"props":2290,"children":2291},{"style":648},[2292],{"type":612,"value":2293},"name",{"type":606,"tag":636,"props":2295,"children":2296},{"style":659},[2297],{"type":612,"value":1037},{"type":606,"tag":636,"props":2299,"children":2300},{"style":695},[2301],{"type":612,"value":1042},{"type":606,"tag":636,"props":2303,"children":2304},{"style":659},[2305],{"type":612,"value":1027},{"type":606,"tag":636,"props":2307,"children":2308},{"style":648},[2309],{"type":612,"value":1087},{"type":606,"tag":636,"props":2311,"children":2312},{"style":659},[2313],{"type":612,"value":1037},{"type":606,"tag":636,"props":2315,"children":2316},{"style":659},[2317],{"type":612,"value":2318}," {",{"type":606,"tag":636,"props":2320,"children":2321},{"style":648},[2322],{"type":612,"value":2323},"currency",{"type":606,"tag":636,"props":2325,"children":2326},{"style":659},[2327],{"type":612,"value":1037},{"type":606,"tag":636,"props":2329,"children":2330},{"style":695},[2331],{"type":612,"value":2332}," (Stock: ",{"type":606,"tag":636,"props":2334,"children":2335},{"style":659},[2336],{"type":612,"value":1027},{"type":606,"tag":636,"props":2338,"children":2339},{"style":648},[2340],{"type":612,"value":2341},"stock",{"type":606,"tag":636,"props":2343,"children":2344},{"style":659},[2345],{"type":612,"value":1037},{"type":606,"tag":636,"props":2347,"children":2348},{"style":695},[2349],{"type":612,"value":2350},")\"",{"type":606,"tag":636,"props":2352,"children":2353},{"style":648},[2354],{"type":612,"value":914},{"type":606,"tag":1102,"props":2356,"children":2358},{"id":2357},"xml-parsing-methods-reference",[2359],{"type":612,"value":2360},"📋 XML Parsing Methods Reference",{"type":606,"tag":2362,"props":2363,"children":2364},"table",{},[2365,2389],{"type":606,"tag":2366,"props":2367,"children":2368},"thead",{},[2369],{"type":606,"tag":2370,"props":2371,"children":2372},"tr",{},[2373,2379,2384],{"type":606,"tag":2374,"props":2375,"children":2376},"th",{},[2377],{"type":612,"value":2378},"Method",{"type":606,"tag":2374,"props":2380,"children":2381},{},[2382],{"type":612,"value":2383},"Purpose",{"type":606,"tag":2374,"props":2385,"children":2386},{},[2387],{"type":612,"value":2388},"Example",{"type":606,"tag":2390,"props":2391,"children":2392},"tbody",{},[2393,2420,2446,2472,2498,2524],{"type":606,"tag":2370,"props":2394,"children":2395},{},[2396,2406,2411],{"type":606,"tag":2397,"props":2398,"children":2399},"td",{},[2400],{"type":606,"tag":632,"props":2401,"children":2403},{"className":2402},[],[2404],{"type":612,"value":2405},"ET.fromstring()",{"type":606,"tag":2397,"props":2407,"children":2408},{},[2409],{"type":612,"value":2410},"Parse XML string",{"type":606,"tag":2397,"props":2412,"children":2413},{},[2414],{"type":606,"tag":632,"props":2415,"children":2417},{"className":2416},[],[2418],{"type":612,"value":2419},"root = ET.fromstring(xml_text)",{"type":606,"tag":2370,"props":2421,"children":2422},{},[2423,2432,2437],{"type":606,"tag":2397,"props":2424,"children":2425},{},[2426],{"type":606,"tag":632,"props":2427,"children":2429},{"className":2428},[],[2430],{"type":612,"value":2431},"ET.parse()",{"type":606,"tag":2397,"props":2433,"children":2434},{},[2435],{"type":612,"value":2436},"Parse XML file",{"type":606,"tag":2397,"props":2438,"children":2439},{},[2440],{"type":606,"tag":632,"props":2441,"children":2443},{"className":2442},[],[2444],{"type":612,"value":2445},"tree = ET.parse('file.xml')",{"type":606,"tag":2370,"props":2447,"children":2448},{},[2449,2458,2463],{"type":606,"tag":2397,"props":2450,"children":2451},{},[2452],{"type":606,"tag":632,"props":2453,"children":2455},{"className":2454},[],[2456],{"type":612,"value":2457},"find()",{"type":606,"tag":2397,"props":2459,"children":2460},{},[2461],{"type":612,"value":2462},"Find first matching element",{"type":606,"tag":2397,"props":2464,"children":2465},{},[2466],{"type":606,"tag":632,"props":2467,"children":2469},{"className":2468},[],[2470],{"type":612,"value":2471},"element.find('tag')",{"type":606,"tag":2370,"props":2473,"children":2474},{},[2475,2484,2489],{"type":606,"tag":2397,"props":2476,"children":2477},{},[2478],{"type":606,"tag":632,"props":2479,"children":2481},{"className":2480},[],[2482],{"type":612,"value":2483},"findall()",{"type":606,"tag":2397,"props":2485,"children":2486},{},[2487],{"type":612,"value":2488},"Find all matching elements",{"type":606,"tag":2397,"props":2490,"children":2491},{},[2492],{"type":606,"tag":632,"props":2493,"children":2495},{"className":2494},[],[2496],{"type":612,"value":2497},"element.findall('tag')",{"type":606,"tag":2370,"props":2499,"children":2500},{},[2501,2510,2515],{"type":606,"tag":2397,"props":2502,"children":2503},{},[2504],{"type":606,"tag":632,"props":2505,"children":2507},{"className":2506},[],[2508],{"type":612,"value":2509},"get()",{"type":606,"tag":2397,"props":2511,"children":2512},{},[2513],{"type":612,"value":2514},"Get attribute value",{"type":606,"tag":2397,"props":2516,"children":2517},{},[2518],{"type":606,"tag":632,"props":2519,"children":2521},{"className":2520},[],[2522],{"type":612,"value":2523},"element.get('attribute')",{"type":606,"tag":2370,"props":2525,"children":2526},{},[2527,2536,2541],{"type":606,"tag":2397,"props":2528,"children":2529},{},[2530],{"type":606,"tag":632,"props":2531,"children":2533},{"className":2532},[],[2534],{"type":612,"value":2535},".text",{"type":606,"tag":2397,"props":2537,"children":2538},{},[2539],{"type":612,"value":2540},"Get element text content",{"type":606,"tag":2397,"props":2542,"children":2543},{},[2544],{"type":606,"tag":632,"props":2545,"children":2547},{"className":2546},[],[2548],{"type":612,"value":2549},"element.text",{"type":606,"tag":1102,"props":2551,"children":2553},{"id":2552},"html-parsing-with-built-in-tools",[2554],{"type":612,"value":2555},"🔧 HTML Parsing with Built-in Tools",{"type":606,"tag":1240,"props":2557,"children":2559},{"id":2558},"simple-html-parser",[2560],{"type":612,"value":2561},"Simple HTML Parser",{"type":606,"tag":621,"props":2563,"children":2564},{},[2565],{"type":606,"tag":625,"props":2566,"children":2568},{"className":627,"code":2567,"language":629,"meta":8,"style":8},"from html.parser import HTMLParser\n\nclass SimpleHTMLParser(HTMLParser):\n    def __init__(self):\n        super().__init__()\n        self.links = []\n        self.current_tag = None\n        self.content = []\n    \n    def handle_starttag(self, tag, attrs):\n        self.current_tag = tag\n        if tag == 'a':\n            # Extract href attribute from links\n            for attr_name, attr_value in attrs:\n                if attr_name == 'href':\n                    self.links.append(attr_value)\n    \n    def handle_data(self, data):\n        if self.current_tag in ['title', 'h1', 'h2', 'p']:\n            self.content.append(data.strip())\n    \n    def handle_endtag(self, tag):\n        self.current_tag = None\n\n# Sample HTML\nhtml_content = \"\"\"\n\u003Chtml>\n\u003Chead>\n    \u003Ctitle>Sample Page\u003C/title>\n\u003C/head>\n\u003Cbody>\n    \u003Ch1>Welcome\u003C/h1>\n    \u003Cp>This is a paragraph with \u003Ca href=\"https://example.com\">a link\u003C/a>.\u003C/p>\n    \u003Cp>Another paragraph with \u003Ca href=\"/page2\">internal link\u003C/a>.\u003C/p>\n\u003C/body>\n\u003C/html>\n\"\"\"\n\n# Parse HTML\nparser = SimpleHTMLParser()\nparser.feed(html_content)\n\nprint(\"Links found:\")\nfor link in parser.links:\n    print(f\"  {link}\")\n\nprint(\"\\nContent found:\")\nfor content in parser.content:\n    if content:  # Skip empty strings\n        print(f\"  {content}\")\n",[2569],{"type":606,"tag":632,"props":2570,"children":2571},{"__ignoreMap":8},[2572,2594,2601,2628,2646,2669,2691,2712,2732,2739,2756,2776,2803,2811,2833,2859,2872,2879,2896,2957,2970,2977,2994,3013,3020,3028,3044,3052,3060,3068,3076,3084,3092,3100,3108,3116,3124,3131,3138,3146,3163,3171,3178,3198,3219,3259,3266,3295,3316,3334],{"type":606,"tag":636,"props":2573,"children":2574},{"class":638,"line":12},[2575,2580,2585,2589],{"type":606,"tag":636,"props":2576,"children":2577},{"style":642},[2578],{"type":612,"value":2579},"from",{"type":606,"tag":636,"props":2581,"children":2582},{"style":648},[2583],{"type":612,"value":2584}," html.parser ",{"type":606,"tag":636,"props":2586,"children":2587},{"style":642},[2588],{"type":612,"value":645},{"type":606,"tag":636,"props":2590,"children":2591},{"style":648},[2592],{"type":612,"value":2593}," HTMLParser\n",{"type":606,"tag":636,"props":2595,"children":2596},{"class":638,"line":27},[2597],{"type":606,"tag":636,"props":2598,"children":2599},{"emptyLinePlaceholder":13},[2600],{"type":612,"value":670},{"type":606,"tag":636,"props":2602,"children":2603},{"class":638,"line":36},[2604,2609,2615,2619,2624],{"type":606,"tag":636,"props":2605,"children":2606},{"style":642},[2607],{"type":612,"value":2608},"class",{"type":606,"tag":636,"props":2610,"children":2612},{"style":2611},"--shiki-default:#6F42C1;--shiki-app-dark-mode:#B392F0",[2613],{"type":612,"value":2614}," SimpleHTMLParser",{"type":606,"tag":636,"props":2616,"children":2617},{"style":648},[2618],{"type":612,"value":1012},{"type":606,"tag":636,"props":2620,"children":2621},{"style":2611},[2622],{"type":612,"value":2623},"HTMLParser",{"type":606,"tag":636,"props":2625,"children":2626},{"style":648},[2627],{"type":612,"value":887},{"type":606,"tag":636,"props":2629,"children":2630},{"class":638,"line":45},[2631,2636,2641],{"type":606,"tag":636,"props":2632,"children":2633},{"style":642},[2634],{"type":612,"value":2635},"    def",{"type":606,"tag":636,"props":2637,"children":2638},{"style":659},[2639],{"type":612,"value":2640}," __init__",{"type":606,"tag":636,"props":2642,"children":2643},{"style":648},[2644],{"type":612,"value":2645},"(self):\n",{"type":606,"tag":636,"props":2647,"children":2648},{"class":638,"line":54},[2649,2654,2659,2664],{"type":606,"tag":636,"props":2650,"children":2651},{"style":659},[2652],{"type":612,"value":2653},"        super",{"type":606,"tag":636,"props":2655,"children":2656},{"style":648},[2657],{"type":612,"value":2658},"().",{"type":606,"tag":636,"props":2660,"children":2661},{"style":659},[2662],{"type":612,"value":2663},"__init__",{"type":606,"tag":636,"props":2665,"children":2666},{"style":648},[2667],{"type":612,"value":2668},"()\n",{"type":606,"tag":636,"props":2670,"children":2671},{"class":638,"line":63},[2672,2677,2682,2686],{"type":606,"tag":636,"props":2673,"children":2674},{"style":659},[2675],{"type":612,"value":2676},"        self",{"type":606,"tag":636,"props":2678,"children":2679},{"style":648},[2680],{"type":612,"value":2681},".links ",{"type":606,"tag":636,"props":2683,"children":2684},{"style":642},[2685],{"type":612,"value":692},{"type":606,"tag":636,"props":2687,"children":2688},{"style":648},[2689],{"type":612,"value":2690}," []\n",{"type":606,"tag":636,"props":2692,"children":2693},{"class":638,"line":72},[2694,2698,2703,2707],{"type":606,"tag":636,"props":2695,"children":2696},{"style":659},[2697],{"type":612,"value":2676},{"type":606,"tag":636,"props":2699,"children":2700},{"style":648},[2701],{"type":612,"value":2702},".current_tag ",{"type":606,"tag":636,"props":2704,"children":2705},{"style":642},[2706],{"type":612,"value":692},{"type":606,"tag":636,"props":2708,"children":2709},{"style":659},[2710],{"type":612,"value":2711}," None\n",{"type":606,"tag":636,"props":2713,"children":2714},{"class":638,"line":81},[2715,2719,2724,2728],{"type":606,"tag":636,"props":2716,"children":2717},{"style":659},[2718],{"type":612,"value":2676},{"type":606,"tag":636,"props":2720,"children":2721},{"style":648},[2722],{"type":612,"value":2723},".content ",{"type":606,"tag":636,"props":2725,"children":2726},{"style":642},[2727],{"type":612,"value":692},{"type":606,"tag":636,"props":2729,"children":2730},{"style":648},[2731],{"type":612,"value":2690},{"type":606,"tag":636,"props":2733,"children":2734},{"class":638,"line":733},[2735],{"type":606,"tag":636,"props":2736,"children":2737},{"style":648},[2738],{"type":612,"value":999},{"type":606,"tag":636,"props":2740,"children":2741},{"class":638,"line":99},[2742,2746,2751],{"type":606,"tag":636,"props":2743,"children":2744},{"style":642},[2745],{"type":612,"value":2635},{"type":606,"tag":636,"props":2747,"children":2748},{"style":2611},[2749],{"type":612,"value":2750}," handle_starttag",{"type":606,"tag":636,"props":2752,"children":2753},{"style":648},[2754],{"type":612,"value":2755},"(self, tag, attrs):\n",{"type":606,"tag":636,"props":2757,"children":2758},{"class":638,"line":108},[2759,2763,2767,2771],{"type":606,"tag":636,"props":2760,"children":2761},{"style":659},[2762],{"type":612,"value":2676},{"type":606,"tag":636,"props":2764,"children":2765},{"style":648},[2766],{"type":612,"value":2702},{"type":606,"tag":636,"props":2768,"children":2769},{"style":642},[2770],{"type":612,"value":692},{"type":606,"tag":636,"props":2772,"children":2773},{"style":648},[2774],{"type":612,"value":2775}," tag\n",{"type":606,"tag":636,"props":2777,"children":2778},{"class":638,"line":117},[2779,2784,2789,2793,2798],{"type":606,"tag":636,"props":2780,"children":2781},{"style":642},[2782],{"type":612,"value":2783},"        if",{"type":606,"tag":636,"props":2785,"children":2786},{"style":648},[2787],{"type":612,"value":2788}," tag ",{"type":606,"tag":636,"props":2790,"children":2791},{"style":642},[2792],{"type":612,"value":1579},{"type":606,"tag":636,"props":2794,"children":2795},{"style":695},[2796],{"type":612,"value":2797}," 'a'",{"type":606,"tag":636,"props":2799,"children":2800},{"style":648},[2801],{"type":612,"value":2802},":\n",{"type":606,"tag":636,"props":2804,"children":2805},{"class":638,"line":126},[2806],{"type":606,"tag":636,"props":2807,"children":2808},{"style":676},[2809],{"type":612,"value":2810},"            # Extract href attribute from links\n",{"type":606,"tag":636,"props":2812,"children":2813},{"class":638,"line":135},[2814,2819,2824,2828],{"type":606,"tag":636,"props":2815,"children":2816},{"style":642},[2817],{"type":612,"value":2818},"            for",{"type":606,"tag":636,"props":2820,"children":2821},{"style":648},[2822],{"type":612,"value":2823}," attr_name, attr_value ",{"type":606,"tag":636,"props":2825,"children":2826},{"style":642},[2827],{"type":612,"value":872},{"type":606,"tag":636,"props":2829,"children":2830},{"style":648},[2831],{"type":612,"value":2832}," attrs:\n",{"type":606,"tag":636,"props":2834,"children":2835},{"class":638,"line":144},[2836,2841,2846,2850,2855],{"type":606,"tag":636,"props":2837,"children":2838},{"style":642},[2839],{"type":612,"value":2840},"                if",{"type":606,"tag":636,"props":2842,"children":2843},{"style":648},[2844],{"type":612,"value":2845}," attr_name ",{"type":606,"tag":636,"props":2847,"children":2848},{"style":642},[2849],{"type":612,"value":1579},{"type":606,"tag":636,"props":2851,"children":2852},{"style":695},[2853],{"type":612,"value":2854}," 'href'",{"type":606,"tag":636,"props":2856,"children":2857},{"style":648},[2858],{"type":612,"value":2802},{"type":606,"tag":636,"props":2860,"children":2861},{"class":638,"line":153},[2862,2867],{"type":606,"tag":636,"props":2863,"children":2864},{"style":659},[2865],{"type":612,"value":2866},"                    self",{"type":606,"tag":636,"props":2868,"children":2869},{"style":648},[2870],{"type":612,"value":2871},".links.append(attr_value)\n",{"type":606,"tag":636,"props":2873,"children":2874},{"class":638,"line":163},[2875],{"type":606,"tag":636,"props":2876,"children":2877},{"style":648},[2878],{"type":612,"value":999},{"type":606,"tag":636,"props":2880,"children":2881},{"class":638,"line":172},[2882,2886,2891],{"type":606,"tag":636,"props":2883,"children":2884},{"style":642},[2885],{"type":612,"value":2635},{"type":606,"tag":636,"props":2887,"children":2888},{"style":2611},[2889],{"type":612,"value":2890}," handle_data",{"type":606,"tag":636,"props":2892,"children":2893},{"style":648},[2894],{"type":612,"value":2895},"(self, data):\n",{"type":606,"tag":636,"props":2897,"children":2898},{"class":638,"line":181},[2899,2903,2908,2912,2916,2921,2925,2929,2934,2938,2943,2947,2952],{"type":606,"tag":636,"props":2900,"children":2901},{"style":642},[2902],{"type":612,"value":2783},{"type":606,"tag":636,"props":2904,"children":2905},{"style":659},[2906],{"type":612,"value":2907}," self",{"type":606,"tag":636,"props":2909,"children":2910},{"style":648},[2911],{"type":612,"value":2702},{"type":606,"tag":636,"props":2913,"children":2914},{"style":642},[2915],{"type":612,"value":872},{"type":606,"tag":636,"props":2917,"children":2918},{"style":648},[2919],{"type":612,"value":2920}," [",{"type":606,"tag":636,"props":2922,"children":2923},{"style":695},[2924],{"type":612,"value":936},{"type":606,"tag":636,"props":2926,"children":2927},{"style":648},[2928],{"type":612,"value":1230},{"type":606,"tag":636,"props":2930,"children":2931},{"style":695},[2932],{"type":612,"value":2933},"'h1'",{"type":606,"tag":636,"props":2935,"children":2936},{"style":648},[2937],{"type":612,"value":1230},{"type":606,"tag":636,"props":2939,"children":2940},{"style":695},[2941],{"type":612,"value":2942},"'h2'",{"type":606,"tag":636,"props":2944,"children":2945},{"style":648},[2946],{"type":612,"value":1230},{"type":606,"tag":636,"props":2948,"children":2949},{"style":695},[2950],{"type":612,"value":2951},"'p'",{"type":606,"tag":636,"props":2953,"children":2954},{"style":648},[2955],{"type":612,"value":2956},"]:\n",{"type":606,"tag":636,"props":2958,"children":2959},{"class":638,"line":190},[2960,2965],{"type":606,"tag":636,"props":2961,"children":2962},{"style":659},[2963],{"type":612,"value":2964},"            self",{"type":606,"tag":636,"props":2966,"children":2967},{"style":648},[2968],{"type":612,"value":2969},".content.append(data.strip())\n",{"type":606,"tag":636,"props":2971,"children":2972},{"class":638,"line":199},[2973],{"type":606,"tag":636,"props":2974,"children":2975},{"style":648},[2976],{"type":612,"value":999},{"type":606,"tag":636,"props":2978,"children":2979},{"class":638,"line":208},[2980,2984,2989],{"type":606,"tag":636,"props":2981,"children":2982},{"style":642},[2983],{"type":612,"value":2635},{"type":606,"tag":636,"props":2985,"children":2986},{"style":2611},[2987],{"type":612,"value":2988}," handle_endtag",{"type":606,"tag":636,"props":2990,"children":2991},{"style":648},[2992],{"type":612,"value":2993},"(self, tag):\n",{"type":606,"tag":636,"props":2995,"children":2996},{"class":638,"line":217},[2997,3001,3005,3009],{"type":606,"tag":636,"props":2998,"children":2999},{"style":659},[3000],{"type":612,"value":2676},{"type":606,"tag":636,"props":3002,"children":3003},{"style":648},[3004],{"type":612,"value":2702},{"type":606,"tag":636,"props":3006,"children":3007},{"style":642},[3008],{"type":612,"value":692},{"type":606,"tag":636,"props":3010,"children":3011},{"style":659},[3012],{"type":612,"value":2711},{"type":606,"tag":636,"props":3014,"children":3015},{"class":638,"line":227},[3016],{"type":606,"tag":636,"props":3017,"children":3018},{"emptyLinePlaceholder":13},[3019],{"type":612,"value":670},{"type":606,"tag":636,"props":3021,"children":3022},{"class":638,"line":236},[3023],{"type":606,"tag":636,"props":3024,"children":3025},{"style":676},[3026],{"type":612,"value":3027},"# Sample HTML\n",{"type":606,"tag":636,"props":3029,"children":3030},{"class":638,"line":245},[3031,3036,3040],{"type":606,"tag":636,"props":3032,"children":3033},{"style":648},[3034],{"type":612,"value":3035},"html_content ",{"type":606,"tag":636,"props":3037,"children":3038},{"style":642},[3039],{"type":612,"value":692},{"type":606,"tag":636,"props":3041,"children":3042},{"style":695},[3043],{"type":612,"value":698},{"type":606,"tag":636,"props":3045,"children":3046},{"class":638,"line":254},[3047],{"type":606,"tag":636,"props":3048,"children":3049},{"style":695},[3050],{"type":612,"value":3051},"\u003Chtml>\n",{"type":606,"tag":636,"props":3053,"children":3054},{"class":638,"line":263},[3055],{"type":606,"tag":636,"props":3056,"children":3057},{"style":695},[3058],{"type":612,"value":3059},"\u003Chead>\n",{"type":606,"tag":636,"props":3061,"children":3062},{"class":638,"line":272},[3063],{"type":606,"tag":636,"props":3064,"children":3065},{"style":695},[3066],{"type":612,"value":3067},"    \u003Ctitle>Sample Page\u003C/title>\n",{"type":606,"tag":636,"props":3069,"children":3070},{"class":638,"line":281},[3071],{"type":606,"tag":636,"props":3072,"children":3073},{"style":695},[3074],{"type":612,"value":3075},"\u003C/head>\n",{"type":606,"tag":636,"props":3077,"children":3078},{"class":638,"line":291},[3079],{"type":606,"tag":636,"props":3080,"children":3081},{"style":695},[3082],{"type":612,"value":3083},"\u003Cbody>\n",{"type":606,"tag":636,"props":3085,"children":3086},{"class":638,"line":302},[3087],{"type":606,"tag":636,"props":3088,"children":3089},{"style":695},[3090],{"type":612,"value":3091},"    \u003Ch1>Welcome\u003C/h1>\n",{"type":606,"tag":636,"props":3093,"children":3094},{"class":638,"line":311},[3095],{"type":606,"tag":636,"props":3096,"children":3097},{"style":695},[3098],{"type":612,"value":3099},"    \u003Cp>This is a paragraph with \u003Ca href=\"https://example.com\">a link\u003C/a>.\u003C/p>\n",{"type":606,"tag":636,"props":3101,"children":3102},{"class":638,"line":320},[3103],{"type":606,"tag":636,"props":3104,"children":3105},{"style":695},[3106],{"type":612,"value":3107},"    \u003Cp>Another paragraph with \u003Ca href=\"/page2\">internal link\u003C/a>.\u003C/p>\n",{"type":606,"tag":636,"props":3109,"children":3110},{"class":638,"line":329},[3111],{"type":606,"tag":636,"props":3112,"children":3113},{"style":695},[3114],{"type":612,"value":3115},"\u003C/body>\n",{"type":606,"tag":636,"props":3117,"children":3118},{"class":638,"line":338},[3119],{"type":606,"tag":636,"props":3120,"children":3121},{"style":695},[3122],{"type":612,"value":3123},"\u003C/html>\n",{"type":606,"tag":636,"props":3125,"children":3126},{"class":638,"line":347},[3127],{"type":606,"tag":636,"props":3128,"children":3129},{"style":695},[3130],{"type":612,"value":802},{"type":606,"tag":636,"props":3132,"children":3133},{"class":638,"line":356},[3134],{"type":606,"tag":636,"props":3135,"children":3136},{"emptyLinePlaceholder":13},[3137],{"type":612,"value":670},{"type":606,"tag":636,"props":3139,"children":3140},{"class":638,"line":367},[3141],{"type":606,"tag":636,"props":3142,"children":3143},{"style":676},[3144],{"type":612,"value":3145},"# Parse HTML\n",{"type":606,"tag":636,"props":3147,"children":3148},{"class":638,"line":376},[3149,3154,3158],{"type":606,"tag":636,"props":3150,"children":3151},{"style":648},[3152],{"type":612,"value":3153},"parser ",{"type":606,"tag":636,"props":3155,"children":3156},{"style":642},[3157],{"type":612,"value":692},{"type":606,"tag":636,"props":3159,"children":3160},{"style":648},[3161],{"type":612,"value":3162}," SimpleHTMLParser()\n",{"type":606,"tag":636,"props":3164,"children":3165},{"class":638,"line":385},[3166],{"type":606,"tag":636,"props":3167,"children":3168},{"style":648},[3169],{"type":612,"value":3170},"parser.feed(html_content)\n",{"type":606,"tag":636,"props":3172,"children":3173},{"class":638,"line":394},[3174],{"type":606,"tag":636,"props":3175,"children":3176},{"emptyLinePlaceholder":13},[3177],{"type":612,"value":670},{"type":606,"tag":636,"props":3179,"children":3180},{"class":638,"line":403},[3181,3185,3189,3194],{"type":606,"tag":636,"props":3182,"children":3183},{"style":659},[3184],{"type":612,"value":1628},{"type":606,"tag":636,"props":3186,"children":3187},{"style":648},[3188],{"type":612,"value":1012},{"type":606,"tag":636,"props":3190,"children":3191},{"style":695},[3192],{"type":612,"value":3193},"\"Links found:\"",{"type":606,"tag":636,"props":3195,"children":3196},{"style":648},[3197],{"type":612,"value":914},{"type":606,"tag":636,"props":3199,"children":3200},{"class":638,"line":412},[3201,3205,3210,3214],{"type":606,"tag":636,"props":3202,"children":3203},{"style":642},[3204],{"type":612,"value":862},{"type":606,"tag":636,"props":3206,"children":3207},{"style":648},[3208],{"type":612,"value":3209}," link ",{"type":606,"tag":636,"props":3211,"children":3212},{"style":642},[3213],{"type":612,"value":872},{"type":606,"tag":636,"props":3215,"children":3216},{"style":648},[3217],{"type":612,"value":3218}," parser.links:\n",{"type":606,"tag":636,"props":3220,"children":3221},{"class":638,"line":423},[3222,3226,3230,3234,3238,3242,3247,3251,3255],{"type":606,"tag":636,"props":3223,"children":3224},{"style":659},[3225],{"type":612,"value":1007},{"type":606,"tag":636,"props":3227,"children":3228},{"style":648},[3229],{"type":612,"value":1012},{"type":606,"tag":636,"props":3231,"children":3232},{"style":642},[3233],{"type":612,"value":1017},{"type":606,"tag":636,"props":3235,"children":3236},{"style":695},[3237],{"type":612,"value":2284},{"type":606,"tag":636,"props":3239,"children":3240},{"style":659},[3241],{"type":612,"value":1027},{"type":606,"tag":636,"props":3243,"children":3244},{"style":648},[3245],{"type":612,"value":3246},"link",{"type":606,"tag":636,"props":3248,"children":3249},{"style":659},[3250],{"type":612,"value":1037},{"type":606,"tag":636,"props":3252,"children":3253},{"style":695},[3254],{"type":612,"value":1096},{"type":606,"tag":636,"props":3256,"children":3257},{"style":648},[3258],{"type":612,"value":914},{"type":606,"tag":636,"props":3260,"children":3261},{"class":638,"line":432},[3262],{"type":606,"tag":636,"props":3263,"children":3264},{"emptyLinePlaceholder":13},[3265],{"type":612,"value":670},{"type":606,"tag":636,"props":3267,"children":3268},{"class":638,"line":441},[3269,3273,3277,3281,3286,3291],{"type":606,"tag":636,"props":3270,"children":3271},{"style":659},[3272],{"type":612,"value":1628},{"type":606,"tag":636,"props":3274,"children":3275},{"style":648},[3276],{"type":612,"value":1012},{"type":606,"tag":636,"props":3278,"children":3279},{"style":695},[3280],{"type":612,"value":1096},{"type":606,"tag":636,"props":3282,"children":3283},{"style":659},[3284],{"type":612,"value":3285},"\\n",{"type":606,"tag":636,"props":3287,"children":3288},{"style":695},[3289],{"type":612,"value":3290},"Content found:\"",{"type":606,"tag":636,"props":3292,"children":3293},{"style":648},[3294],{"type":612,"value":914},{"type":606,"tag":636,"props":3296,"children":3297},{"class":638,"line":450},[3298,3302,3307,3311],{"type":606,"tag":636,"props":3299,"children":3300},{"style":642},[3301],{"type":612,"value":862},{"type":606,"tag":636,"props":3303,"children":3304},{"style":648},[3305],{"type":612,"value":3306}," content ",{"type":606,"tag":636,"props":3308,"children":3309},{"style":642},[3310],{"type":612,"value":872},{"type":606,"tag":636,"props":3312,"children":3313},{"style":648},[3314],{"type":612,"value":3315}," parser.content:\n",{"type":606,"tag":636,"props":3317,"children":3318},{"class":638,"line":459},[3319,3324,3329],{"type":606,"tag":636,"props":3320,"children":3321},{"style":642},[3322],{"type":612,"value":3323},"    if",{"type":606,"tag":636,"props":3325,"children":3326},{"style":648},[3327],{"type":612,"value":3328}," content:  ",{"type":606,"tag":636,"props":3330,"children":3331},{"style":676},[3332],{"type":612,"value":3333},"# Skip empty strings\n",{"type":606,"tag":636,"props":3335,"children":3336},{"class":638,"line":468},[3337,3342,3346,3350,3354,3358,3362,3366,3370],{"type":606,"tag":636,"props":3338,"children":3339},{"style":659},[3340],{"type":612,"value":3341},"        print",{"type":606,"tag":636,"props":3343,"children":3344},{"style":648},[3345],{"type":612,"value":1012},{"type":606,"tag":636,"props":3347,"children":3348},{"style":642},[3349],{"type":612,"value":1017},{"type":606,"tag":636,"props":3351,"children":3352},{"style":695},[3353],{"type":612,"value":2284},{"type":606,"tag":636,"props":3355,"children":3356},{"style":659},[3357],{"type":612,"value":1027},{"type":606,"tag":636,"props":3359,"children":3360},{"style":648},[3361],{"type":612,"value":17},{"type":606,"tag":636,"props":3363,"children":3364},{"style":659},[3365],{"type":612,"value":1037},{"type":606,"tag":636,"props":3367,"children":3368},{"style":695},[3369],{"type":612,"value":1096},{"type":606,"tag":636,"props":3371,"children":3372},{"style":648},[3373],{"type":612,"value":914},{"type":606,"tag":1240,"props":3375,"children":3377},{"id":3376},"html-data-extraction",[3378],{"type":612,"value":3379},"HTML Data Extraction",{"type":606,"tag":621,"props":3381,"children":3382},{},[3383],{"type":606,"tag":625,"props":3384,"children":3386},{"className":627,"code":3385,"language":629,"meta":8,"style":8},"import re\n\ndef extract_html_data(html):\n    \"\"\"Simple HTML data extraction using regex (for basic cases)\"\"\"\n    \n    # Extract title\n    title_match = re.search(r'\u003Ctitle>(.*?)\u003C/title>', html, re.IGNORECASE)\n    title = title_match.group(1) if title_match else \"No title\"\n    \n    # Extract all links\n    links = re.findall(r'\u003Ca[^>]+href=[\\'\"](.*?)[\\'\"][^>]*>', html, re.IGNORECASE)\n    \n    # Extract text content (remove HTML tags)\n    text_content = re.sub(r'\u003C[^>]+>', '', html)\n    # Clean up whitespace\n    text_content = re.sub(r'\\s+', ' ', text_content).strip()\n    \n    return {\n        'title': title,\n        'links': links,\n        'text': text_content[:200] + '...' if len(text_content) > 200 else text_content\n    }\n\n# Sample HTML\nsample_html = \"\"\"\n\u003Chtml>\n\u003Chead>\u003Ctitle>Product Page\u003C/title>\u003C/head>\n\u003Cbody>\n    \u003Ch1>Amazing Product\u003C/h1>\n    \u003Cp>This product is \u003Cstrong>fantastic\u003C/strong>!\u003C/p>\n    \u003Ca href=\"/buy-now\">Buy Now\u003C/a>\n    \u003Ca href=\"mailto:support@example.com\">Contact Support\u003C/a>\n\u003C/body>\n\u003C/html>\n\"\"\"\n\nextracted_data = extract_html_data(sample_html)\nprint(f\"Title: {extracted_data['title']}\")\nprint(f\"Links: {extracted_data['links']}\")\nprint(f\"Text: {extracted_data['text']}\")\n",[3387],{"type":606,"tag":632,"props":3388,"children":3389},{"__ignoreMap":8},[3390,3402,3409,3427,3435,3442,3450,3521,3567,3574,3582,3704,3711,3719,3787,3795,3845,3852,3865,3878,3891,3957,3965,3972,3979,3995,4002,4010,4017,4025,4033,4041,4049,4056,4063,4070,4077,4094,4144,4193],{"type":606,"tag":636,"props":3391,"children":3392},{"class":638,"line":12},[3393,3397],{"type":606,"tag":636,"props":3394,"children":3395},{"style":642},[3396],{"type":612,"value":645},{"type":606,"tag":636,"props":3398,"children":3399},{"style":648},[3400],{"type":612,"value":3401}," re\n",{"type":606,"tag":636,"props":3403,"children":3404},{"class":638,"line":27},[3405],{"type":606,"tag":636,"props":3406,"children":3407},{"emptyLinePlaceholder":13},[3408],{"type":612,"value":670},{"type":606,"tag":636,"props":3410,"children":3411},{"class":638,"line":36},[3412,3417,3422],{"type":606,"tag":636,"props":3413,"children":3414},{"style":642},[3415],{"type":612,"value":3416},"def",{"type":606,"tag":636,"props":3418,"children":3419},{"style":2611},[3420],{"type":612,"value":3421}," extract_html_data",{"type":606,"tag":636,"props":3423,"children":3424},{"style":648},[3425],{"type":612,"value":3426},"(html):\n",{"type":606,"tag":636,"props":3428,"children":3429},{"class":638,"line":45},[3430],{"type":606,"tag":636,"props":3431,"children":3432},{"style":695},[3433],{"type":612,"value":3434},"    \"\"\"Simple HTML data extraction using regex (for basic cases)\"\"\"\n",{"type":606,"tag":636,"props":3436,"children":3437},{"class":638,"line":54},[3438],{"type":606,"tag":636,"props":3439,"children":3440},{"style":648},[3441],{"type":612,"value":999},{"type":606,"tag":636,"props":3443,"children":3444},{"class":638,"line":63},[3445],{"type":606,"tag":636,"props":3446,"children":3447},{"style":676},[3448],{"type":612,"value":3449},"    # Extract title\n",{"type":606,"tag":636,"props":3451,"children":3452},{"class":638,"line":72},[3453,3458,3462,3467,3472,3477,3483,3488,3493,3498,3503,3507,3512,3517],{"type":606,"tag":636,"props":3454,"children":3455},{"style":648},[3456],{"type":612,"value":3457},"    title_match ",{"type":606,"tag":636,"props":3459,"children":3460},{"style":642},[3461],{"type":612,"value":692},{"type":606,"tag":636,"props":3463,"children":3464},{"style":648},[3465],{"type":612,"value":3466}," re.search(",{"type":606,"tag":636,"props":3468,"children":3469},{"style":642},[3470],{"type":612,"value":3471},"r",{"type":606,"tag":636,"props":3473,"children":3474},{"style":695},[3475],{"type":612,"value":3476},"'",{"type":606,"tag":636,"props":3478,"children":3480},{"style":3479},"--shiki-default:#032F62;--shiki-app-dark-mode:#DBEDFF",[3481],{"type":612,"value":3482},"\u003Ctitle>",{"type":606,"tag":636,"props":3484,"children":3485},{"style":659},[3486],{"type":612,"value":3487},"(.",{"type":606,"tag":636,"props":3489,"children":3490},{"style":642},[3491],{"type":612,"value":3492},"*?",{"type":606,"tag":636,"props":3494,"children":3495},{"style":659},[3496],{"type":612,"value":3497},")",{"type":606,"tag":636,"props":3499,"children":3500},{"style":3479},[3501],{"type":612,"value":3502},"\u003C/title>",{"type":606,"tag":636,"props":3504,"children":3505},{"style":695},[3506],{"type":612,"value":3476},{"type":606,"tag":636,"props":3508,"children":3509},{"style":648},[3510],{"type":612,"value":3511},", html, re.",{"type":606,"tag":636,"props":3513,"children":3514},{"style":659},[3515],{"type":612,"value":3516},"IGNORECASE",{"type":606,"tag":636,"props":3518,"children":3519},{"style":648},[3520],{"type":612,"value":914},{"type":606,"tag":636,"props":3522,"children":3523},{"class":638,"line":81},[3524,3528,3532,3537,3542,3547,3552,3557,3562],{"type":606,"tag":636,"props":3525,"children":3526},{"style":648},[3527],{"type":612,"value":922},{"type":606,"tag":636,"props":3529,"children":3530},{"style":642},[3531],{"type":612,"value":692},{"type":606,"tag":636,"props":3533,"children":3534},{"style":648},[3535],{"type":612,"value":3536}," title_match.group(",{"type":606,"tag":636,"props":3538,"children":3539},{"style":659},[3540],{"type":612,"value":3541},"1",{"type":606,"tag":636,"props":3543,"children":3544},{"style":648},[3545],{"type":612,"value":3546},") ",{"type":606,"tag":636,"props":3548,"children":3549},{"style":642},[3550],{"type":612,"value":3551},"if",{"type":606,"tag":636,"props":3553,"children":3554},{"style":648},[3555],{"type":612,"value":3556}," title_match ",{"type":606,"tag":636,"props":3558,"children":3559},{"style":642},[3560],{"type":612,"value":3561},"else",{"type":606,"tag":636,"props":3563,"children":3564},{"style":695},[3565],{"type":612,"value":3566}," \"No title\"\n",{"type":606,"tag":636,"props":3568,"children":3569},{"class":638,"line":733},[3570],{"type":606,"tag":636,"props":3571,"children":3572},{"style":648},[3573],{"type":612,"value":999},{"type":606,"tag":636,"props":3575,"children":3576},{"class":638,"line":99},[3577],{"type":606,"tag":636,"props":3578,"children":3579},{"style":676},[3580],{"type":612,"value":3581},"    # Extract all links\n",{"type":606,"tag":636,"props":3583,"children":3584},{"class":638,"line":108},[3585,3590,3594,3599,3603,3607,3612,3617,3622,3627,3632,3637,3641,3647,3652,3656,3661,3665,3670,3674,3678,3683,3688,3692,3696,3700],{"type":606,"tag":636,"props":3586,"children":3587},{"style":648},[3588],{"type":612,"value":3589},"    links ",{"type":606,"tag":636,"props":3591,"children":3592},{"style":642},[3593],{"type":612,"value":692},{"type":606,"tag":636,"props":3595,"children":3596},{"style":648},[3597],{"type":612,"value":3598}," re.findall(",{"type":606,"tag":636,"props":3600,"children":3601},{"style":642},[3602],{"type":612,"value":3471},{"type":606,"tag":636,"props":3604,"children":3605},{"style":695},[3606],{"type":612,"value":3476},{"type":606,"tag":636,"props":3608,"children":3609},{"style":3479},[3610],{"type":612,"value":3611},"\u003Ca",{"type":606,"tag":636,"props":3613,"children":3614},{"style":659},[3615],{"type":612,"value":3616},"[",{"type":606,"tag":636,"props":3618,"children":3619},{"style":642},[3620],{"type":612,"value":3621},"^",{"type":606,"tag":636,"props":3623,"children":3624},{"style":659},[3625],{"type":612,"value":3626},">]",{"type":606,"tag":636,"props":3628,"children":3629},{"style":642},[3630],{"type":612,"value":3631},"+",{"type":606,"tag":636,"props":3633,"children":3634},{"style":3479},[3635],{"type":612,"value":3636},"href=",{"type":606,"tag":636,"props":3638,"children":3639},{"style":659},[3640],{"type":612,"value":3616},{"type":606,"tag":636,"props":3642,"children":3644},{"style":3643},"--shiki-default:#22863A;--shiki-default-font-weight:bold;--shiki-app-dark-mode:#85E89D;--shiki-app-dark-mode-font-weight:bold",[3645],{"type":612,"value":3646},"\\'",{"type":606,"tag":636,"props":3648,"children":3649},{"style":659},[3650],{"type":612,"value":3651},"\"](.",{"type":606,"tag":636,"props":3653,"children":3654},{"style":642},[3655],{"type":612,"value":3492},{"type":606,"tag":636,"props":3657,"children":3658},{"style":659},[3659],{"type":612,"value":3660},")[",{"type":606,"tag":636,"props":3662,"children":3663},{"style":3643},[3664],{"type":612,"value":3646},{"type":606,"tag":636,"props":3666,"children":3667},{"style":659},[3668],{"type":612,"value":3669},"\"][",{"type":606,"tag":636,"props":3671,"children":3672},{"style":642},[3673],{"type":612,"value":3621},{"type":606,"tag":636,"props":3675,"children":3676},{"style":659},[3677],{"type":612,"value":3626},{"type":606,"tag":636,"props":3679,"children":3680},{"style":642},[3681],{"type":612,"value":3682},"*",{"type":606,"tag":636,"props":3684,"children":3685},{"style":3479},[3686],{"type":612,"value":3687},">",{"type":606,"tag":636,"props":3689,"children":3690},{"style":695},[3691],{"type":612,"value":3476},{"type":606,"tag":636,"props":3693,"children":3694},{"style":648},[3695],{"type":612,"value":3511},{"type":606,"tag":636,"props":3697,"children":3698},{"style":659},[3699],{"type":612,"value":3516},{"type":606,"tag":636,"props":3701,"children":3702},{"style":648},[3703],{"type":612,"value":914},{"type":606,"tag":636,"props":3705,"children":3706},{"class":638,"line":117},[3707],{"type":606,"tag":636,"props":3708,"children":3709},{"style":648},[3710],{"type":612,"value":999},{"type":606,"tag":636,"props":3712,"children":3713},{"class":638,"line":126},[3714],{"type":606,"tag":636,"props":3715,"children":3716},{"style":676},[3717],{"type":612,"value":3718},"    # Extract text content (remove HTML tags)\n",{"type":606,"tag":636,"props":3720,"children":3721},{"class":638,"line":135},[3722,3727,3731,3736,3740,3744,3749,3753,3757,3761,3765,3769,3773,3777,3782],{"type":606,"tag":636,"props":3723,"children":3724},{"style":648},[3725],{"type":612,"value":3726},"    text_content ",{"type":606,"tag":636,"props":3728,"children":3729},{"style":642},[3730],{"type":612,"value":692},{"type":606,"tag":636,"props":3732,"children":3733},{"style":648},[3734],{"type":612,"value":3735}," re.sub(",{"type":606,"tag":636,"props":3737,"children":3738},{"style":642},[3739],{"type":612,"value":3471},{"type":606,"tag":636,"props":3741,"children":3742},{"style":695},[3743],{"type":612,"value":3476},{"type":606,"tag":636,"props":3745,"children":3746},{"style":3479},[3747],{"type":612,"value":3748},"\u003C",{"type":606,"tag":636,"props":3750,"children":3751},{"style":659},[3752],{"type":612,"value":3616},{"type":606,"tag":636,"props":3754,"children":3755},{"style":642},[3756],{"type":612,"value":3621},{"type":606,"tag":636,"props":3758,"children":3759},{"style":659},[3760],{"type":612,"value":3626},{"type":606,"tag":636,"props":3762,"children":3763},{"style":642},[3764],{"type":612,"value":3631},{"type":606,"tag":636,"props":3766,"children":3767},{"style":3479},[3768],{"type":612,"value":3687},{"type":606,"tag":636,"props":3770,"children":3771},{"style":695},[3772],{"type":612,"value":3476},{"type":606,"tag":636,"props":3774,"children":3775},{"style":648},[3776],{"type":612,"value":1230},{"type":606,"tag":636,"props":3778,"children":3779},{"style":695},[3780],{"type":612,"value":3781},"''",{"type":606,"tag":636,"props":3783,"children":3784},{"style":648},[3785],{"type":612,"value":3786},", html)\n",{"type":606,"tag":636,"props":3788,"children":3789},{"class":638,"line":144},[3790],{"type":606,"tag":636,"props":3791,"children":3792},{"style":676},[3793],{"type":612,"value":3794},"    # Clean up whitespace\n",{"type":606,"tag":636,"props":3796,"children":3797},{"class":638,"line":153},[3798,3802,3806,3810,3814,3818,3823,3827,3831,3835,3840],{"type":606,"tag":636,"props":3799,"children":3800},{"style":648},[3801],{"type":612,"value":3726},{"type":606,"tag":636,"props":3803,"children":3804},{"style":642},[3805],{"type":612,"value":692},{"type":606,"tag":636,"props":3807,"children":3808},{"style":648},[3809],{"type":612,"value":3735},{"type":606,"tag":636,"props":3811,"children":3812},{"style":642},[3813],{"type":612,"value":3471},{"type":606,"tag":636,"props":3815,"children":3816},{"style":695},[3817],{"type":612,"value":3476},{"type":606,"tag":636,"props":3819,"children":3820},{"style":659},[3821],{"type":612,"value":3822},"\\s",{"type":606,"tag":636,"props":3824,"children":3825},{"style":642},[3826],{"type":612,"value":3631},{"type":606,"tag":636,"props":3828,"children":3829},{"style":695},[3830],{"type":612,"value":3476},{"type":606,"tag":636,"props":3832,"children":3833},{"style":648},[3834],{"type":612,"value":1230},{"type":606,"tag":636,"props":3836,"children":3837},{"style":695},[3838],{"type":612,"value":3839},"' '",{"type":606,"tag":636,"props":3841,"children":3842},{"style":648},[3843],{"type":612,"value":3844},", text_content).strip()\n",{"type":606,"tag":636,"props":3846,"children":3847},{"class":638,"line":163},[3848],{"type":606,"tag":636,"props":3849,"children":3850},{"style":648},[3851],{"type":612,"value":999},{"type":606,"tag":636,"props":3853,"children":3854},{"class":638,"line":172},[3855,3860],{"type":606,"tag":636,"props":3856,"children":3857},{"style":642},[3858],{"type":612,"value":3859},"    return",{"type":606,"tag":636,"props":3861,"children":3862},{"style":648},[3863],{"type":612,"value":3864}," {\n",{"type":606,"tag":636,"props":3866,"children":3867},{"class":638,"line":181},[3868,3873],{"type":606,"tag":636,"props":3869,"children":3870},{"style":695},[3871],{"type":612,"value":3872},"        'title'",{"type":606,"tag":636,"props":3874,"children":3875},{"style":648},[3876],{"type":612,"value":3877},": title,\n",{"type":606,"tag":636,"props":3879,"children":3880},{"class":638,"line":190},[3881,3886],{"type":606,"tag":636,"props":3882,"children":3883},{"style":695},[3884],{"type":612,"value":3885},"        'links'",{"type":606,"tag":636,"props":3887,"children":3888},{"style":648},[3889],{"type":612,"value":3890},": links,\n",{"type":606,"tag":636,"props":3892,"children":3893},{"class":638,"line":199},[3894,3899,3904,3909,3914,3918,3923,3928,3933,3938,3942,3947,3952],{"type":606,"tag":636,"props":3895,"children":3896},{"style":695},[3897],{"type":612,"value":3898},"        'text'",{"type":606,"tag":636,"props":3900,"children":3901},{"style":648},[3902],{"type":612,"value":3903},": text_content[:",{"type":606,"tag":636,"props":3905,"children":3906},{"style":659},[3907],{"type":612,"value":3908},"200",{"type":606,"tag":636,"props":3910,"children":3911},{"style":648},[3912],{"type":612,"value":3913},"] ",{"type":606,"tag":636,"props":3915,"children":3916},{"style":642},[3917],{"type":612,"value":3631},{"type":606,"tag":636,"props":3919,"children":3920},{"style":695},[3921],{"type":612,"value":3922}," '...'",{"type":606,"tag":636,"props":3924,"children":3925},{"style":642},[3926],{"type":612,"value":3927}," if",{"type":606,"tag":636,"props":3929,"children":3930},{"style":659},[3931],{"type":612,"value":3932}," len",{"type":606,"tag":636,"props":3934,"children":3935},{"style":648},[3936],{"type":612,"value":3937},"(text_content) ",{"type":606,"tag":636,"props":3939,"children":3940},{"style":642},[3941],{"type":612,"value":3687},{"type":606,"tag":636,"props":3943,"children":3944},{"style":659},[3945],{"type":612,"value":3946}," 200",{"type":606,"tag":636,"props":3948,"children":3949},{"style":642},[3950],{"type":612,"value":3951}," else",{"type":606,"tag":636,"props":3953,"children":3954},{"style":648},[3955],{"type":612,"value":3956}," text_content\n",{"type":606,"tag":636,"props":3958,"children":3959},{"class":638,"line":208},[3960],{"type":606,"tag":636,"props":3961,"children":3962},{"style":648},[3963],{"type":612,"value":3964},"    }\n",{"type":606,"tag":636,"props":3966,"children":3967},{"class":638,"line":217},[3968],{"type":606,"tag":636,"props":3969,"children":3970},{"emptyLinePlaceholder":13},[3971],{"type":612,"value":670},{"type":606,"tag":636,"props":3973,"children":3974},{"class":638,"line":227},[3975],{"type":606,"tag":636,"props":3976,"children":3977},{"style":676},[3978],{"type":612,"value":3027},{"type":606,"tag":636,"props":3980,"children":3981},{"class":638,"line":236},[3982,3987,3991],{"type":606,"tag":636,"props":3983,"children":3984},{"style":648},[3985],{"type":612,"value":3986},"sample_html ",{"type":606,"tag":636,"props":3988,"children":3989},{"style":642},[3990],{"type":612,"value":692},{"type":606,"tag":636,"props":3992,"children":3993},{"style":695},[3994],{"type":612,"value":698},{"type":606,"tag":636,"props":3996,"children":3997},{"class":638,"line":245},[3998],{"type":606,"tag":636,"props":3999,"children":4000},{"style":695},[4001],{"type":612,"value":3051},{"type":606,"tag":636,"props":4003,"children":4004},{"class":638,"line":254},[4005],{"type":606,"tag":636,"props":4006,"children":4007},{"style":695},[4008],{"type":612,"value":4009},"\u003Chead>\u003Ctitle>Product Page\u003C/title>\u003C/head>\n",{"type":606,"tag":636,"props":4011,"children":4012},{"class":638,"line":263},[4013],{"type":606,"tag":636,"props":4014,"children":4015},{"style":695},[4016],{"type":612,"value":3083},{"type":606,"tag":636,"props":4018,"children":4019},{"class":638,"line":272},[4020],{"type":606,"tag":636,"props":4021,"children":4022},{"style":695},[4023],{"type":612,"value":4024},"    \u003Ch1>Amazing Product\u003C/h1>\n",{"type":606,"tag":636,"props":4026,"children":4027},{"class":638,"line":281},[4028],{"type":606,"tag":636,"props":4029,"children":4030},{"style":695},[4031],{"type":612,"value":4032},"    \u003Cp>This product is \u003Cstrong>fantastic\u003C/strong>!\u003C/p>\n",{"type":606,"tag":636,"props":4034,"children":4035},{"class":638,"line":291},[4036],{"type":606,"tag":636,"props":4037,"children":4038},{"style":695},[4039],{"type":612,"value":4040},"    \u003Ca href=\"/buy-now\">Buy Now\u003C/a>\n",{"type":606,"tag":636,"props":4042,"children":4043},{"class":638,"line":302},[4044],{"type":606,"tag":636,"props":4045,"children":4046},{"style":695},[4047],{"type":612,"value":4048},"    \u003Ca href=\"mailto:support@example.com\">Contact Support\u003C/a>\n",{"type":606,"tag":636,"props":4050,"children":4051},{"class":638,"line":311},[4052],{"type":606,"tag":636,"props":4053,"children":4054},{"style":695},[4055],{"type":612,"value":3115},{"type":606,"tag":636,"props":4057,"children":4058},{"class":638,"line":320},[4059],{"type":606,"tag":636,"props":4060,"children":4061},{"style":695},[4062],{"type":612,"value":3123},{"type":606,"tag":636,"props":4064,"children":4065},{"class":638,"line":329},[4066],{"type":606,"tag":636,"props":4067,"children":4068},{"style":695},[4069],{"type":612,"value":802},{"type":606,"tag":636,"props":4071,"children":4072},{"class":638,"line":338},[4073],{"type":606,"tag":636,"props":4074,"children":4075},{"emptyLinePlaceholder":13},[4076],{"type":612,"value":670},{"type":606,"tag":636,"props":4078,"children":4079},{"class":638,"line":347},[4080,4085,4089],{"type":606,"tag":636,"props":4081,"children":4082},{"style":648},[4083],{"type":612,"value":4084},"extracted_data ",{"type":606,"tag":636,"props":4086,"children":4087},{"style":642},[4088],{"type":612,"value":692},{"type":606,"tag":636,"props":4090,"children":4091},{"style":648},[4092],{"type":612,"value":4093}," extract_html_data(sample_html)\n",{"type":606,"tag":636,"props":4095,"children":4096},{"class":638,"line":356},[4097,4101,4105,4109,4114,4118,4123,4127,4132,4136,4140],{"type":606,"tag":636,"props":4098,"children":4099},{"style":659},[4100],{"type":612,"value":1628},{"type":606,"tag":636,"props":4102,"children":4103},{"style":648},[4104],{"type":612,"value":1012},{"type":606,"tag":636,"props":4106,"children":4107},{"style":642},[4108],{"type":612,"value":1017},{"type":606,"tag":636,"props":4110,"children":4111},{"style":695},[4112],{"type":612,"value":4113},"\"Title: ",{"type":606,"tag":636,"props":4115,"children":4116},{"style":659},[4117],{"type":612,"value":1027},{"type":606,"tag":636,"props":4119,"children":4120},{"style":648},[4121],{"type":612,"value":4122},"extracted_data[",{"type":606,"tag":636,"props":4124,"children":4125},{"style":695},[4126],{"type":612,"value":936},{"type":606,"tag":636,"props":4128,"children":4129},{"style":648},[4130],{"type":612,"value":4131},"]",{"type":606,"tag":636,"props":4133,"children":4134},{"style":659},[4135],{"type":612,"value":1037},{"type":606,"tag":636,"props":4137,"children":4138},{"style":695},[4139],{"type":612,"value":1096},{"type":606,"tag":636,"props":4141,"children":4142},{"style":648},[4143],{"type":612,"value":914},{"type":606,"tag":636,"props":4145,"children":4146},{"class":638,"line":367},[4147,4151,4155,4159,4164,4168,4172,4177,4181,4185,4189],{"type":606,"tag":636,"props":4148,"children":4149},{"style":659},[4150],{"type":612,"value":1628},{"type":606,"tag":636,"props":4152,"children":4153},{"style":648},[4154],{"type":612,"value":1012},{"type":606,"tag":636,"props":4156,"children":4157},{"style":642},[4158],{"type":612,"value":1017},{"type":606,"tag":636,"props":4160,"children":4161},{"style":695},[4162],{"type":612,"value":4163},"\"Links: ",{"type":606,"tag":636,"props":4165,"children":4166},{"style":659},[4167],{"type":612,"value":1027},{"type":606,"tag":636,"props":4169,"children":4170},{"style":648},[4171],{"type":612,"value":4122},{"type":606,"tag":636,"props":4173,"children":4174},{"style":695},[4175],{"type":612,"value":4176},"'links'",{"type":606,"tag":636,"props":4178,"children":4179},{"style":648},[4180],{"type":612,"value":4131},{"type":606,"tag":636,"props":4182,"children":4183},{"style":659},[4184],{"type":612,"value":1037},{"type":606,"tag":636,"props":4186,"children":4187},{"style":695},[4188],{"type":612,"value":1096},{"type":606,"tag":636,"props":4190,"children":4191},{"style":648},[4192],{"type":612,"value":914},{"type":606,"tag":636,"props":4194,"children":4195},{"class":638,"line":376},[4196,4200,4204,4208,4213,4217,4221,4226,4230,4234,4238],{"type":606,"tag":636,"props":4197,"children":4198},{"style":659},[4199],{"type":612,"value":1628},{"type":606,"tag":636,"props":4201,"children":4202},{"style":648},[4203],{"type":612,"value":1012},{"type":606,"tag":636,"props":4205,"children":4206},{"style":642},[4207],{"type":612,"value":1017},{"type":606,"tag":636,"props":4209,"children":4210},{"style":695},[4211],{"type":612,"value":4212},"\"Text: ",{"type":606,"tag":636,"props":4214,"children":4215},{"style":659},[4216],{"type":612,"value":1027},{"type":606,"tag":636,"props":4218,"children":4219},{"style":648},[4220],{"type":612,"value":4122},{"type":606,"tag":636,"props":4222,"children":4223},{"style":695},[4224],{"type":612,"value":4225},"'text'",{"type":606,"tag":636,"props":4227,"children":4228},{"style":648},[4229],{"type":612,"value":4131},{"type":606,"tag":636,"props":4231,"children":4232},{"style":659},[4233],{"type":612,"value":1037},{"type":606,"tag":636,"props":4235,"children":4236},{"style":695},[4237],{"type":612,"value":1096},{"type":606,"tag":636,"props":4239,"children":4240},{"style":648},[4241],{"type":612,"value":914},{"type":606,"tag":1102,"props":4243,"children":4245},{"id":4244},"️-creating-xml-documents",[4246],{"type":612,"value":4247},"🏗️ Creating XML Documents",{"type":606,"tag":1240,"props":4249,"children":4251},{"id":4250},"building-xml-with-elementtree",[4252],{"type":612,"value":4253},"Building XML with ElementTree",{"type":606,"tag":621,"props":4255,"children":4256},{},[4257],{"type":606,"tag":625,"props":4258,"children":4260},{"className":627,"code":4259,"language":629,"meta":8,"style":8},"import xml.etree.ElementTree as ET\n\ndef create_xml_report(data):\n    # Create root element\n    root = ET.Element(\"report\")\n    root.set(\"generated\", \"2024-01-15\")\n    \n    # Add summary section\n    summary = ET.SubElement(root, \"summary\")\n    ET.SubElement(summary, \"total_items\").text = str(len(data))\n    ET.SubElement(summary, \"total_value\").text = str(sum(item['price'] for item in data))\n    \n    # Add items section\n    items = ET.SubElement(root, \"items\")\n    \n    for item_data in data:\n        item = ET.SubElement(items, \"item\")\n        item.set(\"id\", str(item_data['id']))\n        \n        ET.SubElement(item, \"name\").text = item_data['name']\n        ET.SubElement(item, \"price\").text = str(item_data['price'])\n        ET.SubElement(item, \"category\").text = item_data['category']\n    \n    return root\n\n# Sample data\nsample_data = [\n    {'id': 1, 'name': 'Laptop', 'price': 999.99, 'category': 'Electronics'},\n    {'id': 2, 'name': 'Book', 'price': 29.99, 'category': 'Education'},\n    {'id': 3, 'name': 'Coffee Mug', 'price': 12.99, 'category': 'Kitchen'}\n]\n\n# Create XML report\nxml_root = create_xml_report(sample_data)\n\n# Convert to string for display\nxml_string = ET.tostring(xml_root, encoding='unicode')\nprint(\"Generated XML:\")\nprint(xml_string)\n",[4261],{"type":606,"tag":632,"props":4262,"children":4263},{"__ignoreMap":8},[4264,4283,4290,4307,4315,4345,4371,4378,4386,4416,4461,4529,4536,4544,4573,4580,4602,4632,4668,4676,4716,4757,4793,4800,4812,4819,4827,4844,4920,4995,5071,5078,5085,5093,5110,5117,5125,5165,5185],{"type":606,"tag":636,"props":4265,"children":4266},{"class":638,"line":12},[4267,4271,4275,4279],{"type":606,"tag":636,"props":4268,"children":4269},{"style":642},[4270],{"type":612,"value":645},{"type":606,"tag":636,"props":4272,"children":4273},{"style":648},[4274],{"type":612,"value":651},{"type":606,"tag":636,"props":4276,"children":4277},{"style":642},[4278],{"type":612,"value":656},{"type":606,"tag":636,"props":4280,"children":4281},{"style":659},[4282],{"type":612,"value":662},{"type":606,"tag":636,"props":4284,"children":4285},{"class":638,"line":27},[4286],{"type":606,"tag":636,"props":4287,"children":4288},{"emptyLinePlaceholder":13},[4289],{"type":612,"value":670},{"type":606,"tag":636,"props":4291,"children":4292},{"class":638,"line":36},[4293,4297,4302],{"type":606,"tag":636,"props":4294,"children":4295},{"style":642},[4296],{"type":612,"value":3416},{"type":606,"tag":636,"props":4298,"children":4299},{"style":2611},[4300],{"type":612,"value":4301}," create_xml_report",{"type":606,"tag":636,"props":4303,"children":4304},{"style":648},[4305],{"type":612,"value":4306},"(data):\n",{"type":606,"tag":636,"props":4308,"children":4309},{"class":638,"line":45},[4310],{"type":606,"tag":636,"props":4311,"children":4312},{"style":676},[4313],{"type":612,"value":4314},"    # Create root element\n",{"type":606,"tag":636,"props":4316,"children":4317},{"class":638,"line":54},[4318,4323,4327,4331,4336,4341],{"type":606,"tag":636,"props":4319,"children":4320},{"style":648},[4321],{"type":612,"value":4322},"    root ",{"type":606,"tag":636,"props":4324,"children":4325},{"style":642},[4326],{"type":612,"value":692},{"type":606,"tag":636,"props":4328,"children":4329},{"style":659},[4330],{"type":612,"value":834},{"type":606,"tag":636,"props":4332,"children":4333},{"style":648},[4334],{"type":612,"value":4335},".Element(",{"type":606,"tag":636,"props":4337,"children":4338},{"style":695},[4339],{"type":612,"value":4340},"\"report\"",{"type":606,"tag":636,"props":4342,"children":4343},{"style":648},[4344],{"type":612,"value":914},{"type":606,"tag":636,"props":4346,"children":4347},{"class":638,"line":63},[4348,4353,4358,4362,4367],{"type":606,"tag":636,"props":4349,"children":4350},{"style":648},[4351],{"type":612,"value":4352},"    root.set(",{"type":606,"tag":636,"props":4354,"children":4355},{"style":695},[4356],{"type":612,"value":4357},"\"generated\"",{"type":606,"tag":636,"props":4359,"children":4360},{"style":648},[4361],{"type":612,"value":1230},{"type":606,"tag":636,"props":4363,"children":4364},{"style":695},[4365],{"type":612,"value":4366},"\"2024-01-15\"",{"type":606,"tag":636,"props":4368,"children":4369},{"style":648},[4370],{"type":612,"value":914},{"type":606,"tag":636,"props":4372,"children":4373},{"class":638,"line":72},[4374],{"type":606,"tag":636,"props":4375,"children":4376},{"style":648},[4377],{"type":612,"value":999},{"type":606,"tag":636,"props":4379,"children":4380},{"class":638,"line":81},[4381],{"type":606,"tag":636,"props":4382,"children":4383},{"style":676},[4384],{"type":612,"value":4385},"    # Add summary section\n",{"type":606,"tag":636,"props":4387,"children":4388},{"class":638,"line":733},[4389,4394,4398,4402,4407,4412],{"type":606,"tag":636,"props":4390,"children":4391},{"style":648},[4392],{"type":612,"value":4393},"    summary ",{"type":606,"tag":636,"props":4395,"children":4396},{"style":642},[4397],{"type":612,"value":692},{"type":606,"tag":636,"props":4399,"children":4400},{"style":659},[4401],{"type":612,"value":834},{"type":606,"tag":636,"props":4403,"children":4404},{"style":648},[4405],{"type":612,"value":4406},".SubElement(root, ",{"type":606,"tag":636,"props":4408,"children":4409},{"style":695},[4410],{"type":612,"value":4411},"\"summary\"",{"type":606,"tag":636,"props":4413,"children":4414},{"style":648},[4415],{"type":612,"value":914},{"type":606,"tag":636,"props":4417,"children":4418},{"class":638,"line":99},[4419,4424,4429,4434,4438,4442,4447,4451,4456],{"type":606,"tag":636,"props":4420,"children":4421},{"style":659},[4422],{"type":612,"value":4423},"    ET",{"type":606,"tag":636,"props":4425,"children":4426},{"style":648},[4427],{"type":612,"value":4428},".SubElement(summary, ",{"type":606,"tag":636,"props":4430,"children":4431},{"style":695},[4432],{"type":612,"value":4433},"\"total_items\"",{"type":606,"tag":636,"props":4435,"children":4436},{"style":648},[4437],{"type":612,"value":1574},{"type":606,"tag":636,"props":4439,"children":4440},{"style":642},[4441],{"type":612,"value":692},{"type":606,"tag":636,"props":4443,"children":4444},{"style":659},[4445],{"type":612,"value":4446}," str",{"type":606,"tag":636,"props":4448,"children":4449},{"style":648},[4450],{"type":612,"value":1012},{"type":606,"tag":636,"props":4452,"children":4453},{"style":659},[4454],{"type":612,"value":4455},"len",{"type":606,"tag":636,"props":4457,"children":4458},{"style":648},[4459],{"type":612,"value":4460},"(data))\n",{"type":606,"tag":636,"props":4462,"children":4463},{"class":638,"line":108},[4464,4468,4472,4477,4481,4485,4489,4493,4498,4503,4507,4511,4515,4520,4524],{"type":606,"tag":636,"props":4465,"children":4466},{"style":659},[4467],{"type":612,"value":4423},{"type":606,"tag":636,"props":4469,"children":4470},{"style":648},[4471],{"type":612,"value":4428},{"type":606,"tag":636,"props":4473,"children":4474},{"style":695},[4475],{"type":612,"value":4476},"\"total_value\"",{"type":606,"tag":636,"props":4478,"children":4479},{"style":648},[4480],{"type":612,"value":1574},{"type":606,"tag":636,"props":4482,"children":4483},{"style":642},[4484],{"type":612,"value":692},{"type":606,"tag":636,"props":4486,"children":4487},{"style":659},[4488],{"type":612,"value":4446},{"type":606,"tag":636,"props":4490,"children":4491},{"style":648},[4492],{"type":612,"value":1012},{"type":606,"tag":636,"props":4494,"children":4495},{"style":659},[4496],{"type":612,"value":4497},"sum",{"type":606,"tag":636,"props":4499,"children":4500},{"style":648},[4501],{"type":612,"value":4502},"(item[",{"type":606,"tag":636,"props":4504,"children":4505},{"style":695},[4506],{"type":612,"value":987},{"type":606,"tag":636,"props":4508,"children":4509},{"style":648},[4510],{"type":612,"value":3913},{"type":606,"tag":636,"props":4512,"children":4513},{"style":642},[4514],{"type":612,"value":862},{"type":606,"tag":636,"props":4516,"children":4517},{"style":648},[4518],{"type":612,"value":4519}," item ",{"type":606,"tag":636,"props":4521,"children":4522},{"style":642},[4523],{"type":612,"value":872},{"type":606,"tag":636,"props":4525,"children":4526},{"style":648},[4527],{"type":612,"value":4528}," data))\n",{"type":606,"tag":636,"props":4530,"children":4531},{"class":638,"line":117},[4532],{"type":606,"tag":636,"props":4533,"children":4534},{"style":648},[4535],{"type":612,"value":999},{"type":606,"tag":636,"props":4537,"children":4538},{"class":638,"line":126},[4539],{"type":606,"tag":636,"props":4540,"children":4541},{"style":676},[4542],{"type":612,"value":4543},"    # Add items section\n",{"type":606,"tag":636,"props":4545,"children":4546},{"class":638,"line":135},[4547,4552,4556,4560,4564,4569],{"type":606,"tag":636,"props":4548,"children":4549},{"style":648},[4550],{"type":612,"value":4551},"    items ",{"type":606,"tag":636,"props":4553,"children":4554},{"style":642},[4555],{"type":612,"value":692},{"type":606,"tag":636,"props":4557,"children":4558},{"style":659},[4559],{"type":612,"value":834},{"type":606,"tag":636,"props":4561,"children":4562},{"style":648},[4563],{"type":612,"value":4406},{"type":606,"tag":636,"props":4565,"children":4566},{"style":695},[4567],{"type":612,"value":4568},"\"items\"",{"type":606,"tag":636,"props":4570,"children":4571},{"style":648},[4572],{"type":612,"value":914},{"type":606,"tag":636,"props":4574,"children":4575},{"class":638,"line":144},[4576],{"type":606,"tag":636,"props":4577,"children":4578},{"style":648},[4579],{"type":612,"value":999},{"type":606,"tag":636,"props":4581,"children":4582},{"class":638,"line":153},[4583,4588,4593,4597],{"type":606,"tag":636,"props":4584,"children":4585},{"style":642},[4586],{"type":612,"value":4587},"    for",{"type":606,"tag":636,"props":4589,"children":4590},{"style":648},[4591],{"type":612,"value":4592}," item_data ",{"type":606,"tag":636,"props":4594,"children":4595},{"style":642},[4596],{"type":612,"value":872},{"type":606,"tag":636,"props":4598,"children":4599},{"style":648},[4600],{"type":612,"value":4601}," data:\n",{"type":606,"tag":636,"props":4603,"children":4604},{"class":638,"line":163},[4605,4610,4614,4618,4623,4628],{"type":606,"tag":636,"props":4606,"children":4607},{"style":648},[4608],{"type":612,"value":4609},"        item ",{"type":606,"tag":636,"props":4611,"children":4612},{"style":642},[4613],{"type":612,"value":692},{"type":606,"tag":636,"props":4615,"children":4616},{"style":659},[4617],{"type":612,"value":834},{"type":606,"tag":636,"props":4619,"children":4620},{"style":648},[4621],{"type":612,"value":4622},".SubElement(items, ",{"type":606,"tag":636,"props":4624,"children":4625},{"style":695},[4626],{"type":612,"value":4627},"\"item\"",{"type":606,"tag":636,"props":4629,"children":4630},{"style":648},[4631],{"type":612,"value":914},{"type":606,"tag":636,"props":4633,"children":4634},{"class":638,"line":172},[4635,4640,4645,4649,4654,4659,4663],{"type":606,"tag":636,"props":4636,"children":4637},{"style":648},[4638],{"type":612,"value":4639},"        item.set(",{"type":606,"tag":636,"props":4641,"children":4642},{"style":695},[4643],{"type":612,"value":4644},"\"id\"",{"type":606,"tag":636,"props":4646,"children":4647},{"style":648},[4648],{"type":612,"value":1230},{"type":606,"tag":636,"props":4650,"children":4651},{"style":659},[4652],{"type":612,"value":4653},"str",{"type":606,"tag":636,"props":4655,"children":4656},{"style":648},[4657],{"type":612,"value":4658},"(item_data[",{"type":606,"tag":636,"props":4660,"children":4661},{"style":695},[4662],{"type":612,"value":909},{"type":606,"tag":636,"props":4664,"children":4665},{"style":648},[4666],{"type":612,"value":4667},"]))\n",{"type":606,"tag":636,"props":4669,"children":4670},{"class":638,"line":181},[4671],{"type":606,"tag":636,"props":4672,"children":4673},{"style":648},[4674],{"type":612,"value":4675},"        \n",{"type":606,"tag":636,"props":4677,"children":4678},{"class":638,"line":190},[4679,4684,4689,4694,4698,4702,4707,4711],{"type":606,"tag":636,"props":4680,"children":4681},{"style":659},[4682],{"type":612,"value":4683},"        ET",{"type":606,"tag":636,"props":4685,"children":4686},{"style":648},[4687],{"type":612,"value":4688},".SubElement(item, ",{"type":606,"tag":636,"props":4690,"children":4691},{"style":695},[4692],{"type":612,"value":4693},"\"name\"",{"type":606,"tag":636,"props":4695,"children":4696},{"style":648},[4697],{"type":612,"value":1574},{"type":606,"tag":636,"props":4699,"children":4700},{"style":642},[4701],{"type":612,"value":692},{"type":606,"tag":636,"props":4703,"children":4704},{"style":648},[4705],{"type":612,"value":4706}," item_data[",{"type":606,"tag":636,"props":4708,"children":4709},{"style":695},[4710],{"type":612,"value":2092},{"type":606,"tag":636,"props":4712,"children":4713},{"style":648},[4714],{"type":612,"value":4715},"]\n",{"type":606,"tag":636,"props":4717,"children":4718},{"class":638,"line":199},[4719,4723,4727,4732,4736,4740,4744,4748,4752],{"type":606,"tag":636,"props":4720,"children":4721},{"style":659},[4722],{"type":612,"value":4683},{"type":606,"tag":636,"props":4724,"children":4725},{"style":648},[4726],{"type":612,"value":4688},{"type":606,"tag":636,"props":4728,"children":4729},{"style":695},[4730],{"type":612,"value":4731},"\"price\"",{"type":606,"tag":636,"props":4733,"children":4734},{"style":648},[4735],{"type":612,"value":1574},{"type":606,"tag":636,"props":4737,"children":4738},{"style":642},[4739],{"type":612,"value":692},{"type":606,"tag":636,"props":4741,"children":4742},{"style":659},[4743],{"type":612,"value":4446},{"type":606,"tag":636,"props":4745,"children":4746},{"style":648},[4747],{"type":612,"value":4658},{"type":606,"tag":636,"props":4749,"children":4750},{"style":695},[4751],{"type":612,"value":987},{"type":606,"tag":636,"props":4753,"children":4754},{"style":648},[4755],{"type":612,"value":4756},"])\n",{"type":606,"tag":636,"props":4758,"children":4759},{"class":638,"line":208},[4760,4764,4768,4773,4777,4781,4785,4789],{"type":606,"tag":636,"props":4761,"children":4762},{"style":659},[4763],{"type":612,"value":4683},{"type":606,"tag":636,"props":4765,"children":4766},{"style":648},[4767],{"type":612,"value":4688},{"type":606,"tag":636,"props":4769,"children":4770},{"style":695},[4771],{"type":612,"value":4772},"\"category\"",{"type":606,"tag":636,"props":4774,"children":4775},{"style":648},[4776],{"type":612,"value":1574},{"type":606,"tag":636,"props":4778,"children":4779},{"style":642},[4780],{"type":612,"value":692},{"type":606,"tag":636,"props":4782,"children":4783},{"style":648},[4784],{"type":612,"value":4706},{"type":606,"tag":636,"props":4786,"children":4787},{"style":695},[4788],{"type":612,"value":2051},{"type":606,"tag":636,"props":4790,"children":4791},{"style":648},[4792],{"type":612,"value":4715},{"type":606,"tag":636,"props":4794,"children":4795},{"class":638,"line":217},[4796],{"type":606,"tag":636,"props":4797,"children":4798},{"style":648},[4799],{"type":612,"value":999},{"type":606,"tag":636,"props":4801,"children":4802},{"class":638,"line":227},[4803,4807],{"type":606,"tag":636,"props":4804,"children":4805},{"style":642},[4806],{"type":612,"value":3859},{"type":606,"tag":636,"props":4808,"children":4809},{"style":648},[4810],{"type":612,"value":4811}," root\n",{"type":606,"tag":636,"props":4813,"children":4814},{"class":638,"line":236},[4815],{"type":606,"tag":636,"props":4816,"children":4817},{"emptyLinePlaceholder":13},[4818],{"type":612,"value":670},{"type":606,"tag":636,"props":4820,"children":4821},{"class":638,"line":245},[4822],{"type":606,"tag":636,"props":4823,"children":4824},{"style":676},[4825],{"type":612,"value":4826},"# Sample data\n",{"type":606,"tag":636,"props":4828,"children":4829},{"class":638,"line":254},[4830,4835,4839],{"type":606,"tag":636,"props":4831,"children":4832},{"style":648},[4833],{"type":612,"value":4834},"sample_data ",{"type":606,"tag":636,"props":4836,"children":4837},{"style":642},[4838],{"type":612,"value":692},{"type":606,"tag":636,"props":4840,"children":4841},{"style":648},[4842],{"type":612,"value":4843}," [\n",{"type":606,"tag":636,"props":4845,"children":4846},{"class":638,"line":263},[4847,4852,4856,4860,4864,4868,4872,4876,4881,4885,4889,4893,4898,4902,4906,4910,4915],{"type":606,"tag":636,"props":4848,"children":4849},{"style":648},[4850],{"type":612,"value":4851},"    {",{"type":606,"tag":636,"props":4853,"children":4854},{"style":695},[4855],{"type":612,"value":909},{"type":606,"tag":636,"props":4857,"children":4858},{"style":648},[4859],{"type":612,"value":1042},{"type":606,"tag":636,"props":4861,"children":4862},{"style":659},[4863],{"type":612,"value":3541},{"type":606,"tag":636,"props":4865,"children":4866},{"style":648},[4867],{"type":612,"value":1230},{"type":606,"tag":636,"props":4869,"children":4870},{"style":695},[4871],{"type":612,"value":2092},{"type":606,"tag":636,"props":4873,"children":4874},{"style":648},[4875],{"type":612,"value":1042},{"type":606,"tag":636,"props":4877,"children":4878},{"style":695},[4879],{"type":612,"value":4880},"'Laptop'",{"type":606,"tag":636,"props":4882,"children":4883},{"style":648},[4884],{"type":612,"value":1230},{"type":606,"tag":636,"props":4886,"children":4887},{"style":695},[4888],{"type":612,"value":987},{"type":606,"tag":636,"props":4890,"children":4891},{"style":648},[4892],{"type":612,"value":1042},{"type":606,"tag":636,"props":4894,"children":4895},{"style":659},[4896],{"type":612,"value":4897},"999.99",{"type":606,"tag":636,"props":4899,"children":4900},{"style":648},[4901],{"type":612,"value":1230},{"type":606,"tag":636,"props":4903,"children":4904},{"style":695},[4905],{"type":612,"value":2051},{"type":606,"tag":636,"props":4907,"children":4908},{"style":648},[4909],{"type":612,"value":1042},{"type":606,"tag":636,"props":4911,"children":4912},{"style":695},[4913],{"type":612,"value":4914},"'Electronics'",{"type":606,"tag":636,"props":4916,"children":4917},{"style":648},[4918],{"type":612,"value":4919},"},\n",{"type":606,"tag":636,"props":4921,"children":4922},{"class":638,"line":272},[4923,4927,4931,4935,4940,4944,4948,4952,4957,4961,4965,4969,4974,4978,4982,4986,4991],{"type":606,"tag":636,"props":4924,"children":4925},{"style":648},[4926],{"type":612,"value":4851},{"type":606,"tag":636,"props":4928,"children":4929},{"style":695},[4930],{"type":612,"value":909},{"type":606,"tag":636,"props":4932,"children":4933},{"style":648},[4934],{"type":612,"value":1042},{"type":606,"tag":636,"props":4936,"children":4937},{"style":659},[4938],{"type":612,"value":4939},"2",{"type":606,"tag":636,"props":4941,"children":4942},{"style":648},[4943],{"type":612,"value":1230},{"type":606,"tag":636,"props":4945,"children":4946},{"style":695},[4947],{"type":612,"value":2092},{"type":606,"tag":636,"props":4949,"children":4950},{"style":648},[4951],{"type":612,"value":1042},{"type":606,"tag":636,"props":4953,"children":4954},{"style":695},[4955],{"type":612,"value":4956},"'Book'",{"type":606,"tag":636,"props":4958,"children":4959},{"style":648},[4960],{"type":612,"value":1230},{"type":606,"tag":636,"props":4962,"children":4963},{"style":695},[4964],{"type":612,"value":987},{"type":606,"tag":636,"props":4966,"children":4967},{"style":648},[4968],{"type":612,"value":1042},{"type":606,"tag":636,"props":4970,"children":4971},{"style":659},[4972],{"type":612,"value":4973},"29.99",{"type":606,"tag":636,"props":4975,"children":4976},{"style":648},[4977],{"type":612,"value":1230},{"type":606,"tag":636,"props":4979,"children":4980},{"style":695},[4981],{"type":612,"value":2051},{"type":606,"tag":636,"props":4983,"children":4984},{"style":648},[4985],{"type":612,"value":1042},{"type":606,"tag":636,"props":4987,"children":4988},{"style":695},[4989],{"type":612,"value":4990},"'Education'",{"type":606,"tag":636,"props":4992,"children":4993},{"style":648},[4994],{"type":612,"value":4919},{"type":606,"tag":636,"props":4996,"children":4997},{"class":638,"line":281},[4998,5002,5006,5010,5015,5019,5023,5027,5032,5036,5040,5044,5049,5053,5057,5061,5066],{"type":606,"tag":636,"props":4999,"children":5000},{"style":648},[5001],{"type":612,"value":4851},{"type":606,"tag":636,"props":5003,"children":5004},{"style":695},[5005],{"type":612,"value":909},{"type":606,"tag":636,"props":5007,"children":5008},{"style":648},[5009],{"type":612,"value":1042},{"type":606,"tag":636,"props":5011,"children":5012},{"style":659},[5013],{"type":612,"value":5014},"3",{"type":606,"tag":636,"props":5016,"children":5017},{"style":648},[5018],{"type":612,"value":1230},{"type":606,"tag":636,"props":5020,"children":5021},{"style":695},[5022],{"type":612,"value":2092},{"type":606,"tag":636,"props":5024,"children":5025},{"style":648},[5026],{"type":612,"value":1042},{"type":606,"tag":636,"props":5028,"children":5029},{"style":695},[5030],{"type":612,"value":5031},"'Coffee Mug'",{"type":606,"tag":636,"props":5033,"children":5034},{"style":648},[5035],{"type":612,"value":1230},{"type":606,"tag":636,"props":5037,"children":5038},{"style":695},[5039],{"type":612,"value":987},{"type":606,"tag":636,"props":5041,"children":5042},{"style":648},[5043],{"type":612,"value":1042},{"type":606,"tag":636,"props":5045,"children":5046},{"style":659},[5047],{"type":612,"value":5048},"12.99",{"type":606,"tag":636,"props":5050,"children":5051},{"style":648},[5052],{"type":612,"value":1230},{"type":606,"tag":636,"props":5054,"children":5055},{"style":695},[5056],{"type":612,"value":2051},{"type":606,"tag":636,"props":5058,"children":5059},{"style":648},[5060],{"type":612,"value":1042},{"type":606,"tag":636,"props":5062,"children":5063},{"style":695},[5064],{"type":612,"value":5065},"'Kitchen'",{"type":606,"tag":636,"props":5067,"children":5068},{"style":648},[5069],{"type":612,"value":5070},"}\n",{"type":606,"tag":636,"props":5072,"children":5073},{"class":638,"line":291},[5074],{"type":606,"tag":636,"props":5075,"children":5076},{"style":648},[5077],{"type":612,"value":4715},{"type":606,"tag":636,"props":5079,"children":5080},{"class":638,"line":302},[5081],{"type":606,"tag":636,"props":5082,"children":5083},{"emptyLinePlaceholder":13},[5084],{"type":612,"value":670},{"type":606,"tag":636,"props":5086,"children":5087},{"class":638,"line":311},[5088],{"type":606,"tag":636,"props":5089,"children":5090},{"style":676},[5091],{"type":612,"value":5092},"# Create XML report\n",{"type":606,"tag":636,"props":5094,"children":5095},{"class":638,"line":320},[5096,5101,5105],{"type":606,"tag":636,"props":5097,"children":5098},{"style":648},[5099],{"type":612,"value":5100},"xml_root ",{"type":606,"tag":636,"props":5102,"children":5103},{"style":642},[5104],{"type":612,"value":692},{"type":606,"tag":636,"props":5106,"children":5107},{"style":648},[5108],{"type":612,"value":5109}," create_xml_report(sample_data)\n",{"type":606,"tag":636,"props":5111,"children":5112},{"class":638,"line":329},[5113],{"type":606,"tag":636,"props":5114,"children":5115},{"emptyLinePlaceholder":13},[5116],{"type":612,"value":670},{"type":606,"tag":636,"props":5118,"children":5119},{"class":638,"line":338},[5120],{"type":606,"tag":636,"props":5121,"children":5122},{"style":676},[5123],{"type":612,"value":5124},"# Convert to string for display\n",{"type":606,"tag":636,"props":5126,"children":5127},{"class":638,"line":347},[5128,5133,5137,5141,5146,5152,5156,5161],{"type":606,"tag":636,"props":5129,"children":5130},{"style":648},[5131],{"type":612,"value":5132},"xml_string ",{"type":606,"tag":636,"props":5134,"children":5135},{"style":642},[5136],{"type":612,"value":692},{"type":606,"tag":636,"props":5138,"children":5139},{"style":659},[5140],{"type":612,"value":834},{"type":606,"tag":636,"props":5142,"children":5143},{"style":648},[5144],{"type":612,"value":5145},".tostring(xml_root, ",{"type":606,"tag":636,"props":5147,"children":5149},{"style":5148},"--shiki-default:#E36209;--shiki-app-dark-mode:#FFAB70",[5150],{"type":612,"value":5151},"encoding",{"type":606,"tag":636,"props":5153,"children":5154},{"style":642},[5155],{"type":612,"value":692},{"type":606,"tag":636,"props":5157,"children":5158},{"style":695},[5159],{"type":612,"value":5160},"'unicode'",{"type":606,"tag":636,"props":5162,"children":5163},{"style":648},[5164],{"type":612,"value":914},{"type":606,"tag":636,"props":5166,"children":5167},{"class":638,"line":356},[5168,5172,5176,5181],{"type":606,"tag":636,"props":5169,"children":5170},{"style":659},[5171],{"type":612,"value":1628},{"type":606,"tag":636,"props":5173,"children":5174},{"style":648},[5175],{"type":612,"value":1012},{"type":606,"tag":636,"props":5177,"children":5178},{"style":695},[5179],{"type":612,"value":5180},"\"Generated XML:\"",{"type":606,"tag":636,"props":5182,"children":5183},{"style":648},[5184],{"type":612,"value":914},{"type":606,"tag":636,"props":5186,"children":5187},{"class":638,"line":367},[5188,5192],{"type":606,"tag":636,"props":5189,"children":5190},{"style":659},[5191],{"type":612,"value":1628},{"type":606,"tag":636,"props":5193,"children":5194},{"style":648},[5195],{"type":612,"value":5196},"(xml_string)\n",{"type":606,"tag":1102,"props":5198,"children":5200},{"id":5199},"key-takeaways",[5201],{"type":612,"value":5202},"🎯 Key Takeaways",{"type":606,"tag":1114,"props":5204,"children":5208},{"emoji":5205,"title":5206,"type":5207},"📚","XML/HTML Parsing Essentials","success",[5209,5217,5282,5290,5314,5322,5345],{"type":606,"tag":615,"props":5210,"children":5211},{},[5212],{"type":606,"tag":1124,"props":5213,"children":5214},{},[5215],{"type":612,"value":5216},"XML Parsing:",{"type":606,"tag":1130,"props":5218,"children":5219},{},[5220,5230,5247,5264],{"type":606,"tag":1134,"props":5221,"children":5222},{},[5223,5228],{"type":606,"tag":632,"props":5224,"children":5226},{"className":5225},[],[5227],{"type":612,"value":1204},{"type":612,"value":5229}," for built-in XML support",{"type":606,"tag":1134,"props":5231,"children":5232},{},[5233,5238,5240,5245],{"type":606,"tag":632,"props":5234,"children":5236},{"className":5235},[],[5237],{"type":612,"value":2457},{"type":612,"value":5239}," and ",{"type":606,"tag":632,"props":5241,"children":5243},{"className":5242},[],[5244],{"type":612,"value":2483},{"type":612,"value":5246}," to locate elements",{"type":606,"tag":1134,"props":5248,"children":5249},{},[5250,5255,5257,5262],{"type":606,"tag":632,"props":5251,"children":5253},{"className":5252},[],[5254],{"type":612,"value":2509},{"type":612,"value":5256}," for attributes, ",{"type":606,"tag":632,"props":5258,"children":5260},{"className":5259},[],[5261],{"type":612,"value":2535},{"type":612,"value":5263}," for content",{"type":606,"tag":1134,"props":5265,"children":5266},{},[5267,5269,5275,5276],{"type":612,"value":5268},"Create XML with ",{"type":606,"tag":632,"props":5270,"children":5272},{"className":5271},[],[5273],{"type":612,"value":5274},"Element()",{"type":612,"value":5239},{"type":606,"tag":632,"props":5277,"children":5279},{"className":5278},[],[5280],{"type":612,"value":5281},"SubElement()",{"type":606,"tag":615,"props":5283,"children":5284},{},[5285],{"type":606,"tag":1124,"props":5286,"children":5287},{},[5288],{"type":612,"value":5289},"HTML Parsing:",{"type":606,"tag":1130,"props":5291,"children":5292},{},[5293,5304,5309],{"type":606,"tag":1134,"props":5294,"children":5295},{},[5296,5302],{"type":606,"tag":632,"props":5297,"children":5299},{"className":5298},[],[5300],{"type":612,"value":5301},"html.parser.HTMLParser",{"type":612,"value":5303}," for basic HTML parsing",{"type":606,"tag":1134,"props":5305,"children":5306},{},[5307],{"type":612,"value":5308},"Regular expressions for simple extraction (use carefully)",{"type":606,"tag":1134,"props":5310,"children":5311},{},[5312],{"type":612,"value":5313},"Consider third-party libraries for complex HTML",{"type":606,"tag":615,"props":5315,"children":5316},{},[5317],{"type":606,"tag":1124,"props":5318,"children":5319},{},[5320],{"type":612,"value":5321},"Best Practices:",{"type":606,"tag":1130,"props":5323,"children":5324},{},[5325,5330,5335,5340],{"type":606,"tag":1134,"props":5326,"children":5327},{},[5328],{"type":612,"value":5329},"Handle parsing errors gracefully",{"type":606,"tag":1134,"props":5331,"children":5332},{},[5333],{"type":612,"value":5334},"Validate XML structure before processing",{"type":606,"tag":1134,"props":5336,"children":5337},{},[5338],{"type":612,"value":5339},"Use appropriate tools for complexity level",{"type":606,"tag":1134,"props":5341,"children":5342},{},[5343],{"type":612,"value":5344},"Test with real-world data samples",{"type":606,"tag":615,"props":5346,"children":5347},{},[5348,5353],{"type":606,"tag":1124,"props":5349,"children":5350},{},[5351],{"type":612,"value":5352},"Remember:",{"type":612,"value":5354}," Start with built-in tools and upgrade to specialized libraries when needed!",{"type":606,"tag":1102,"props":5356,"children":5358},{"id":5357},"whats-next",[5359],{"type":612,"value":5360},"🚀 What's Next?",{"type":606,"tag":615,"props":5362,"children":5363},{},[5364],{"type":612,"value":5365},"Learn how to fetch and process data from web APIs to integrate external services into your applications.",{"type":606,"tag":615,"props":5367,"children":5368},{},[5369,5374,5375],{"type":606,"tag":1124,"props":5370,"children":5371},{},[5372],{"type":612,"value":5373},"Continue to",{"type":612,"value":1042},{"type":606,"tag":5376,"props":5377,"children":5378},"a",{"href":502},[5379],{"type":612,"value":503},{"type":606,"tag":5381,"props":5382,"children":5383},"style",{},[5384],{"type":612,"value":5385},"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":5387},[5388,5392,5393,5397,5400,5401],{"id":1104,"depth":27,"text":1107,"children":5389},[5390,5391],{"id":1242,"depth":36,"text":1245},{"id":1761,"depth":36,"text":1764},{"id":2357,"depth":27,"text":2360},{"id":2552,"depth":27,"text":2555,"children":5394},[5395,5396],{"id":2558,"depth":36,"text":2561},{"id":3376,"depth":36,"text":3379},{"id":4244,"depth":27,"text":4247,"children":5398},[5399],{"id":4250,"depth":36,"text":4253},{"id":5199,"depth":27,"text":5202},{"id":5357,"depth":27,"text":5360},1782373763077]