How do i read just the last line of a text file?

John Machin sjmachin at lexicon.net
Sun May 29 01:24:26 EDT 2005


nephish wrote:
> Hey there.
> i want to set a variable to represent the last line of a text file
> how do i do that?
> or even better, how do i create a list of the lines of a text file?
> 

Hey there to you too.

According to the manual 
http://www.python.org/doc/2.4.1/lib/bltin-file-objects.html

    readlines([sizehint])
        Read until EOF using readline() and return a list containing
        the lines thus read.

Which part of this don't you understand?




More information about the Python-list mailing list