large arbitrary binary data in python

Carey Evans careye at spamcop.net
Wed Mar 28 02:16:33 EST 2001


[...]

>     3) pipe the data to a shell command like this "gunzip -dc | dd of=device"

As well as using the md5 module, as Steve has pointed out, you can do
all this in Python too, using the gzip module to decompress the data.

Instead if dd, you can use just a standard file object to output it.
If there is some need for blocks of a certain size, and the file
write() method doesn't cut it, use the os.open() and os.write()
functions.

>     How will python handle the large amount of binary data?  Is there a limit to
>     the size of a binary string in python?

The various string object functions in Python take the length as an
int, so you can fit however much that can measure on your platform.
If int is 32 bits, that's two gigabytes of data.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	    "Quiet, you'll miss the humorous conclusion."



More information about the Python-list mailing list