Reading binary from a file...

Bryan Olson fakeaddress at nowhere.org
Wed Mar 8 16:34:49 CET 2006


KraftDiner wrote:
[...]
> In python I'm able to read in binary data from a file.
[...]
> 
> However the data is 16bits per sample and python is storing the
> data in a string.  How do I convert that 8bit data into a list of 16
> bit integers?

On the vast majority of systems, files hold sequences of
eight-bit integers. How you convert from those to your 16-bit
type depends on how the the writer of the file converted the
16-bit integer type to a sequence 8-bit integers.


-- 
--Bryan



More information about the Python-list mailing list