简体   繁体   中英

Changing document's attributes in Python's xml.dom.minidom

I created a xml.dom.minidom.Document .

How do I give it attributes so that when I do .toprettyxml() it will show like this:

<?xml version="1.0" encoding="iso-8859-2"?>

.toprettyxml()具有编码关键字参数:

Document.toprettyxml(self, indent='\t', newl='\n', encoding=None)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM