python - How to read integers from byte file one time? -


i want read data .yuv file using python. these data uint8 integers. use such command:

fp = open(filename, 'rb') data = fp.read(100) 

i 100 bytes data string. know can use ord() transfer 1 byte str 1 integer 1 time. how can read or transfer 100 integers in array 1 time?

use struct.unpack:

with open(filename, 'rb') fp:     integers = struct.unpack('100b', fp.read(100)) 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -