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

fab at slick.airforce-one.org fab at slick.airforce-one.org
Fri Apr 23 18:22:52 CEST 2010


I have to read the contents of a binary file (a PNG file exactly), and
dump it into an RTF file.

The RTF-file has been opened with codecs.open in utf-8 mode.

As I expected, the utf-8 decoder chokes on some combinations of bits;
how can I tell python to dump the bytes as they are, without
interpreting them?



More information about the Python-list mailing list