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
最後の行を次のように変更します。
tre.write('temp.xml', encoding='utf-8')
それ以外の場合lxml、XML は ASCII エンコーディングで書き込まれるため、ASCII 以外のすべての文字をエスケープする必要があります。
lxml