Message77208
I have a program that needs to output binary data to stdout.
I don't want to convert it to a string.
for example something like
sys.stdout.write('0o377')
to write a byte with all the bits turned on.
When I try this, I get an error like:
sys.stdout.write(data)
File "/usr/local/lib/python3.0/io.py", line 1484, in write
s.__class__.__name__)
TypeError: can't write bytes to text stream
I know I can open a file in 'wb' mode and write to it, but what
I want to do is somehow switch the mode of stdout to 'wb' mode.
I read lots of python 3 documentation, as well as searched without
finding a way. |
|
Date |
User |
Action |
Args |
2008-12-07 02:40:11 | lopgok | set | recipients:
+ lopgok |
2008-12-07 02:40:10 | lopgok | set | messageid: <1228617610.98.0.490718240035.issue4571@psf.upfronthosting.co.za> |
2008-12-07 02:40:09 | lopgok | link | issue4571 messages |
2008-12-07 02:40:08 | lopgok | create | |
|