Reputation: 11
I have used ElementTree.parse()
to parse all xml files. This failed when the xml file was 950 MB. So, I switched to ElementTree.iterparse()
which works like a charm.
My question is, should I use ElementTree.iterparse()
for files of all sizes ? Or, may be, put a check on the file size.
If file size is less than X MB, use ElementTree.parse()
, else use ElementTree.iterparse()
).
It would be nice to use one function that does everything. But, will do what is right for the use case.
Thank you.
Upvotes: 1
Views: 40