If count will always be 1, just do:
header = np.fromfile(fobj, dtype=dt, count=1)[0]
You can still index by field name, although the array repr will not display field names.
For instance:
import numpy as np headerfmt='20i,20f,a80' dt = np.dtype(headerfmt)
It may or may not be ideal for your purposes, but it is simple, anyway.
source share