[Tutor] writing binary files
Moshe Zadka
Moshe Zadka <moshez@math.huji.ac.il>
Fri, 28 Jul 2000 14:38:04 +0300 (IDT)
On Fri, 28 Jul 2000 alan.gauld@bt.com wrote:
> How do I write binary data to a file?
> I can open a file with 'wb' as mode but if I do:
>
> b = open('bin.dat','wb')
> for i in range(50): b.write(i)
For that, use the struct module.
Though maybe what you want to do is
for i in range(50):
b.write(chr(i))
--
Moshe Zadka <moshez@math.huji.ac.il>
There is no IGLU cabal.
http://advogato.org/person/moshez