Re: writing binary data

2002-09-10 Thread Jeff Shannon
Syver Enstad wrote: > David Ascher <[EMAIL PROTECTED]> writes: > > > Use 'struct.pack' and then write to a file opened in binary mode > > open('foo.dat', 'wb').write(struct.pack(...)) > > You can also just specify bytes in a string and write it to the file, > like this: > open('foo.dat', 'wb').

Re: writing binary data

2002-09-10 Thread Syver Enstad
David Ascher <[EMAIL PROTECTED]> writes: > John Mark Agosta wrote: > > > > > Where is there a Python function to write binary data directly > > instead of ascii (or other encodings)? The pickle module binary > > format is specific to pickle - that doesn't count, I want to be able > > > to spec

Re: writing binary data

2002-09-09 Thread David Ascher
John Mark Agosta wrote: > > Where is there a Python function to write binary data directly instead > of ascii (or other encodings)? The pickle module binary format is > specific to pickle - that doesn't count, I want to be able to specify > the individual bytes written to a file. Use 'struct