Binary file output using python

Michael Hoffman cam.ac.uk at mh391.invalid
Tue Apr 17 22:19:13 CEST 2007


Chi Yin Cheung wrote:
> Hi,
> Is there a way in python to output binary files? I need to python to 
> write out a stream of 5 million floating point numbers, separated by 
> some separator, but it seems that all python supports natively is string 
> information output, which is extremely space inefficient.

I recommend using PyTables for this sort of thing. It also allows you to 
choose from several compression algorithms. I'm using it to store files 
with 22000 x (2000, 12) datasets, or 528 million Float64s.
-- 
Michael Hoffman



More information about the Python-list mailing list