Skip to content

Instantly share code, notes, and snippets.

@Eugeny
Created October 18, 2010 11:27
Show Gist options
  • Save Eugeny/632064 to your computer and use it in GitHub Desktop.
Save Eugeny/632064 to your computer and use it in GitHub Desktop.
from lxml import etree #python-lxml
e = etree.ElementBase()
s = open('/var/log/boot.log').read()
print repr(s)
s = str(s).encode('utf-8', 'xmlcharrefreplace')
print repr(s)
e.set('attr', s)
print repr(e.get('attr'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment