Andy Leszczynski <leszczynscyATnospam.yahoo.com.nospam> writes: > I have got following program: > > import sys > import binascii > from string import * > sys.stdout.write(binascii.unhexlify("41410A4141")) > > > when I run under Unix I got: > > $ python u.py > u.bin > $ od -t x1 u.bin > 0000000 41 41 0a 41 41 > > and under Windows/Cygwin following: > > $ python u.py > u.bin > $ od -t x1 u.bin > 0000000 41 41 0d 0a 41 41 > 0000006 > > The question is how can I pipe out binary content properly and platform > independently?
It's not normal to write binary content to stdout - you normally write it to a file. Open the file with open(name, 'wb') to write binaries. There doesn't appear to be any way to retroactively change the mode on a file. Which is probably a good thing. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list