Writing binary files

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Fri Sep 14 07:29:47 CEST 2001

----- Original Message ----- 
From: <leind at sofcom.com>

> I have a large amount of binary data in memory (am image)
> and I'm trying to write it to a file.  But I can't find a simple
> example showing how this is done.

You say it's an image.  What graphics module are you using?  PIL?
gdmodule? Something else?

All the standard image modules have a write or save or similar
function or method... or am I misunderstanding the problem?

> I just need to write the data "as is" to a file.
> I've looked at the 'struct' module but that doesn't
> look like what I need.  Also the 'pickle' module
> appears to be used for formating binary data.  Again,
> not what I need.

You need to give us a much more concrete example.  Show us the code.
> Does python have the ablitiy to open a file and write
> binary data to it?
> I'm running under Mandrake linux using python 2.0
> -Daniel
> -- 
> http://mail.python.org/mailman/listinfo/python-list

More information about the Python-list mailing list