On Apr 17, 12:41 pm, Chi Yin Cheung <[EMAIL PROTECTED]> 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'd tried using the pickle module, but it crashed whenever I tried using
> it due to the large amount of data involved.
>
> Thanks for your help!

You can create a binary file by doing something like this:

f = open(r'filename, 'b')
f.write('1,2,3,4,5,6')
f.close()

See also: http://www.devshed.com/c/a/Python/File-Management-in-Python/

Have fun!

Mike

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to