Re: [Tutor] Writing BINARY-CONTENT

Magnus Lycka magnus at thinkware.se
Mon Nov 24 16:43:36 EST 2003


Stefan Dieck <dieck.s at dsoftware.de> wrote:
>  If I want write 256 "different" bytes. Python put 257 bytes to the File.
>  On reading, the lenght is 256 bytes to work with. (-1)
> 
>  It seems like the size I expect, but the file on the disk has more bytes.
> (not really good for binaries)

Really? This is Python 2.3.2 on Win NT:

>>> f = file('x.bin', 'wb')
>>> f.write('x'*25)
>>> f.close()
>>> import os
>>> os.system('DIR')
[snip]
03-11-24  22:37                     25 x.bin
[snip]
0

How are you writing data to the file? Can you show some code?

-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus at thinkware.se



More information about the Tutor mailing list