Guest User

Untitled

a guest
Feb 19th, 2020
41
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from lxml import etree
  2.  
  3. node = etree.Element('node')
  4. node.append(etree.Element('child'))
  5. # another child with text
  6. child = etree.Element('child')
  7. child.text = 'some text'
  8. node.append(child)
  9.  
  10. s = etree.tostring(node, pretty_print=True)
  11. print s
RAW Paste Data