这最终消耗了我所有可用的内存,然后该进程被终止.我已经尝试将标签更改schedule为"较小"标签,但这并没有什么区别.
我做错了什么/如何处理这个大文件iterparse()?
import lxml.etree
for schedule in lxml.etree.iterparse('really-big-file.xml', tag='schedule'):
print "why does this consume all my memory?"
Run Code Online (Sandbox Code Playgroud)
我可以轻松地将其切割并以较小的块处理它,但这比我想要的更糟糕.