File IO read returning a string -> but I want a byte -> Question: Is there a faster more efficient way?

Emile van Sebille emile at fenx.com
Mon Jun 24 03:19:18 CEST 2002


Jay
> #Question: Is there a faster more efficient way?
> 
> from time import clock
> 
> len_data = 20*1024*1024
> data = fp.read(len_data)
> 
> start = clock()
> for i in range(len_data): 
>    norm[i] = struct.unpack("B",data[i])
> finish = clock()

map(ord,data)

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list