How to print to stdout in binary

Jürgen Hermann jhe at webde-ag.de
Fri Jul 7 13:05:55 EDT 2000


"Robin Becker" <robin at jessikat.co.uk> schrieb im Newsbeitrag
news:Oo9IrBA89bZ5EwGY at jessikat.demon.co.uk...
> try creating wstdout.py
>
> import sys
> sys.stdout.write('123456789\n')

try:
    import msvcrt, os
    msvcrt.setmode(1, os.O_BINARY)
except:
    pass

import sys
sys.stdout.write('123456789\n')

[d:\tmp]py binstdout.py >test

[d:\tmp]ls -l test
-rw-r--r--   1 544      everyone       10 Jul  7 19:04 test






More information about the Python-list mailing list