How to print to stdout in binary

Robin Becker robin at jessikat.co.uk
Fri Jul 7 07:31:08 EDT 2000


...
try creating wstdout.py

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

then when I run it as
python wstdout.py >aaa I get the wrong file length as on win32 \n-->\r\n
for text files.

Microsoft(R) Windows 98
   (C)Copyright Microsoft Corp 1981-1999.

C:\>cd \tmp

C:\Tmp>python wstdout.py >aaa

C:\Tmp>dir aaa

 Volume in drive C has no label
 Volume Serial Number is 291A-00FF
 Directory of C:\Tmp

AAA                     11  07/07/00  12:14 aaa
         1 file(s)             11 bytes
         0 dir(s)        2,736.11 MB free

C:\Tmp>

-- 
Robin Becker



More information about the Python-list mailing list