File: example.py

package info (click to toggle)
python-et-xmlfile 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 560 kB
  • sloc: python: 7,847; xml: 13; makefile: 6
file content (11 lines) | stat: -rw-r--r-- 268 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
from io import BytesIO
from xml.etree.ElementTree import Element

from et_xmlfile import xmlfile

out = BytesIO()
with xmlfile(out) as xf:
    el = Element("root")
    xf.write(el) # write the XML straight to the file-like object

assert out.getvalue() == b"<root />"