Python iterparse for all files – big and small
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()
).