Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是使用比较大的 xml 文件的新手,现在我遇到了以下问题:
我正在使用 lxml 包来解析一个 348.9 MB 的 xml 文件,并使用我的 Mac (macOS 10.13.5) 上的活动监视器监控 RAM 使用情况。令人惊讶的是,执行下面的代码示例后占用了 6 GB 的 RAM。
from lxml import etree tree=etree.parse(path_to_file) root=tree.getroot()
谁能向我解释为什么会发生这种情况并提出另一种方法?