Den Tue, 17 Apr 2007 11:07:38 -0700 skrev kyosohma:

> 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 don't understand. To me it seams like there is no space difference:

[EMAIL PROTECTED] ~]$ python
Python 2.4.4 (#1, Oct 23 2006, 13:58:00) 
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open("test2", "w")
>>> f.write(str(range(10**7)))
>>> f.close()
>>> f = open("test", "wb")
>>> f.write(str(range(10**7)))
>>> f.close()
>>> 
[EMAIL PROTECTED] ~]$ ls -l test test2
-rw-rw-r-- 1 thomas thomas 88888890 17 apr 22:28 test
-rw-rw-r-- 1 thomas thomas 88888890 17 apr 22:27 test2
[EMAIL PROTECTED] ~]$
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to