[Python3] Reading a binary file and wrtiting the bytes verbatim in an utf-8 file

Stefan Behnel stefan_ml at behnel.de
Sun Apr 25 01:44:11 EDT 2010


Antoine Pitrou, 25.04.2010 02:16:
> Another possibility is to open the file in binary mode and do the
> encoding yourself when writing text. This might actually be a better
> solution, since I'm not sure RTF uses utf-8 by default.

That's a lot cleaner as it doesn't use two interfaces to write to the same 
file, and doesn't rely on any specific coordination between those two 
interfaces.

Stefan




More information about the Python-list mailing list