Python Forum

Full Version: Handling Large XML Files (>10GB) in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Parsing Big XML Files
Need help to parse very large xml files(>10GB). Could you please help how to avoid memory issues. We can't read the entire file once. Any code example or conceptual explanation please. Thanks
Use lxml and iterparse. When you've finished with an element you will need to use clear to prevent a buildup in memory.
This should let you open an XML file of most any size.