I have a list of 1,000,000 ints stored as a binary file. How do I load this quickly into a Python list? In C I would just read the file into a char array and cast that array as an int array. Is there a way to do something equivalent to this in Python? I know about Python's struct module, but as far as I can tell, that would require an extremely long format string to convert all the ints at once.
struct.unpack('1000000I',f.read()) doesn't seem too long to me. –  roippi
Binary file to python integer list