2 ms·
If you've got something simple like a binary file full of uints (e.g. a raw image), then numpy provides fromfile which is incredibly simple to use. If you have
by joshvm 11y ago
If you've got something simple like a binary file full of uints (e.g. a raw image), then numpy provides fromfile which is incredibly simple to use. If you have tabular data in a known format, you can also pass fairly complicated datatypes.
np.fromfile('data.dat', dtype='uint8')
https://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html https://docs.scipy.org/doc/numpy/reference/generated/numpy.f...
EDIT: Obviously you have the added benefit that your data is returned into a numpy array for easy reshaping etc