What's the best way to parse HTML/XML efficiently with lxml Python? or How do you handle large XML fi

20 Replies, 828 Views

If you’re *really* pressed for speed, try `cElementTree` (built into Python) as a fallback. But lxml Python usually beats it.

`iterparse()` is clunky but necessary for gigabyte files. Otherwise, stick with `etree.parse()`—it’s optimized well.

PS: Avoid deep nesting in your XML; it slows things down.

Messages In This Thread



Users browsing this thread: 1 Guest(s)