Peter Otten wrote: > n = 10**9 - 1 > assert n < sys.maxint > f = open(filename) > wanted_line = itertools.islice(f, n, None).next() > > should do slightly better than your implementation.
It will do vastly better, at least in memory usage terms, because there is no memory eating range call. Regards, Björn -- BOFH excuse #31: cellular telephone interference -- http://mail.python.org/mailman/listinfo/python-list