iterparse and unicode
fredrik at pythonware.com
Mon Aug 25 22:45:49 CEST 2008
George Sakkis wrote:
> It depends on what you mean by "compatible"; e.g. you can't safely do
> [s.decode('utf8') for s in strings] if you have byte strings mixed
> with unicode.
why would you want to decode strings given to you by a library that
returns decoded strings?
if you meant to write "encode", you can indeed safely do
[s.encode('utf8') for s in strings] as long as all strings are returned
by an ET implementation.
More information about the Python-list