Read text files with a specific encoding? using fileinput?
Boudewijn Rempt
boud at valdyas.org
Fri Feb 14 12:06:46 EST 2003
More information about the Python-list mailing list
Fri Feb 14 12:06:46 EST 2003
- Previous message (by thread): Read text files with a specific encoding? using fileinput?
- Next message (by thread): Read text files with a specific encoding? using fileinput?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jim Correia wrote:
> How can I read a test file off disk and interpret it as using a specific
> encoding? (Such as utf-8, iso-latin-1, etc.)
>
s = codecs.open("filename", "utf-8").read() does the trick.
--
Boudewijn Rempt | http://www.valdyas.org
- Previous message (by thread): Read text files with a specific encoding? using fileinput?
- Next message (by thread): Read text files with a specific encoding? using fileinput?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list