[b]"What's the best way to parse XML in Python? Looking for a reliable xml parser python solution."[/b] or [b]"Str

22 Replies, 1789 Views

For real, lxml is the best xml parser python has for big files. ElementTree is fine for small stuff but falls apart with scale.

Memory issues? Use streaming parsers like `iterparse` or even `xml.sax`. They’re not as convenient but won’t crash your script.

Also, if you’re on Linux, `xmllint` (command line) can help pre-process files before parsing. Not pure Python, but sometimes the hack works.

Messages In This Thread



Users browsing this thread: 1 Guest(s)