delete from pattern to pattern if it contains match

Peter Otten __peter__ at web.de
Mon Apr 25 08:33:52 EDT 2016


harirammanohar at gmail.com wrote:
>> tree.write('output.xml')
>> yup its working well if i include register namespace, else i am getting
> ns:0 in every line of output.xml.
>> But its removing top line
> <?xml version="1.0" encoding="ISO-8859-1"?>

The write() method allows you to specify an encoding and/or require an xml 
declaration:
https://docs.python.org/dev/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree.write


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /