Created
October 18, 2010 11:27
-
-
Save Eugeny/632064 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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