Handling text lines from files with some (few) starnge chars
python at bdurham.com
python at bdurham.com
Sat Jun 5 19:49:29 EDT 2010
Chris,
> Specify the encoding of the text when opening the file using the `encoding` parameter. For Windows-1252 for example:
>
> your_file = open("path/to/file.ext", 'r', encoding='cp1252')
This looks similar to the codecs module's functionality. Do you know if
the codecs module is still required in Python 3.x?
Thank you,
Malcolm
More information about the Python-list
mailing list