lmlx & & caracter
stefan_ml at behnel.de
Tue Oct 27 11:06:00 CET 2009
Toff, 27.10.2009 10:14:
> o = open("output.txt","w")
> data = open(filename).read()
> o.write( re.sub('&(?!amp;|quot;|nbsp;|gt;|lt;|laquo;|
> raquo;|copy;|reg;|bul;|rsquo;)', '&', data) )
> xml = etree.parse(filename)
> xml = ET.parse(filename)
Absolutely no reason to write a file here. Use ET.fromstring().
And, just to repeat my question in other words: can't you just fix the
'XML' file before hand? I.e. is it a broken XML file coming from an outside
source that you cannot control, or did you create it yourself?
More information about the Python-list