On Fri, Apr 23, 2010 at 9:48 AM, Chris Rebert <[email protected]> wrote:
> On Fri, Apr 23, 2010 at 9:22 AM,  <[email protected]> wrote:
>> I have to read the contents of a binary file (a PNG file exactly), and
>> dump it into an RTF file.
<snip>
>> how can I tell python to dump the bytes as they are, without
>> interpreting them?
>
> Go around the encoder and write bytes directly to the file:
>
> # Disclaimer: Completely untested
<snip>
> encoded_rtf.write(u"whatever text we want") # use unicode

Erm, sorry, since you're apparently using Python 3.x, that line should
have been just:

encoded_rtf.write("whatever text we want") # use unicode

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to