Cannot find what I'm sure is a simple command... please help.

John Roth johnroth at ameritech.net
Sun Mar 31 19:39:45 EST 2002


"Aahz" <aahz at pythoncraft.com> wrote in message
news:a886fp$sq1$1 at panix1.panix.com...
> In article <3ca7978b.251291804 at mammoth.usenet-access.com>,
> A. Jones <netzapper at magicstar.net> wrote:
> >
> >I seem to have either overlooked, or completely missed a function
that
> >allows one to open a specific line of a file.
>
> There isn't one, unless every line of your file is the same length
> (fixed-length records).  You need to read one line at a time until you
> get to the correct line.

If you read the file into a list using readlines(), you can then
access each line by the index into the list. Unfortunately, that
doesn't get you one line without reading the entire file up to
that point...

John Roth







More information about the Python-list mailing list