python - How to detect EOF with numpy.fromfile -
i trying read in large (several gb) binary file numpy.fromfile(). reading in entire file @ once generates out of memory error, want create loop read , process n chunks of data @ time. following:
while true: numpy.fromfile(f, recordtype, n) # proccess data if f.eof(): break
how detect when have reached end of file, can break loop?
while true: = numpy.fromfile(f, recordtype, n) # proccess data if a.size < n: break
Comments
Post a Comment