File IO read returning a string -> but I want a byte -> Question: Is there a faster more efficient way?
jepler at unpythonic.net
jepler at unpythonic.net
Sun Jun 23 21:49:23 EDT 2002
On Sun, Jun 23, 2002 at 05:27:52PM -0700, Jay wrote:
> #Question: Is there a faster more efficient way?
>
> from time import clock
>
> len_data = 20*1024*1024
> data = fp.read(len_data)
bindata = array.array("b", data)
OR
bindata = array.array("b")
bindata.fromfile(fp, len_data)
Jeff
More information about the Python-list
mailing list