Parsing
Paul Prescod
paul at prescod.net
Mon Apr 12 00:14:55 EDT 2004
Timothy Wu wrote:
> I'm parsing Firefox bookmarks and writing the same bookmark to another
> file. To make sure I read and write utf-8 correctly I make open files
> like this for read and write:
>
> codecs.open(file, "r", "utf-8")
The virtue of this code is that now you have a file object that will
parse FROM UTF-8 into Python Unicode objects. The Unicode objects
neither know nor care that they came from UTF-8.
Paul Prescod
More information about the Python-list
mailing list