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.
我正在使用 lxml 读取 xml 文件并更改一些细节。但是,在运行它时,我发现即使我只是使用 lxml 读取文件然后再次将其写出,如下所示:
fil='iTunes Music Library.XML' tre=etree.parse(fil) tre.write('temp.xml')
我发现 Queensrÿche 转换为Queensrÿche. 有人知道怎么修这个东西吗?
Queensrÿche
将最后一行更改为:
tre.write('temp.xml', encoding='utf-8')
否则lxml以 ASCII 编码写入 XML,因此它必须转义所有非 ASCII 字符。
lxml