Seek the one billionth line in a file containing 3 billion lines.

John J. Lee jjl at pobox.com
Sun Aug 12 08:50:49 EDT 2007


"Chris Mellon" <arkanes at gmail.com> writes:
[...]
> The minimum bounds for a line is at least one byte (the newline) and
> maybe more, depending on your data. You can seek() forward the minimum
> amount of bytes that (1 billion -1) lines will consume and save
> yourself some wasted IO.

But how do you know which line number you're on, then?


John



More information about the Python-list mailing list