On 10.10.2013 15:07, Joe Kington wrote: > You just need to supply the "offset" kwarg to "memmap". > > for example: > > with open(localfile, "r") as fd: > # read offset from first line of file > offset = int(next(fd).split()[-2]) > np.memmap(fd, dtype="float32", mode="r", offset=offset) > > Also, there's no need to do things like "offset = > int(fd.readlines()[0].split()[-2])" > > Just do "offset = int(next(fd).split()[-2])" instead. Readlines reads > the entire file into memory. You only want the first line.
Thanks, Joe, I actually didn't know `next` yet ... -- Andreas. _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
