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

John Machin sjmachin at lexicon.net
Sun May 29 01:57:58 EDT 2005


Chris F.A. Johnson wrote:

> 
> file = open(argv[1])          ## Open the file given on the command line
> all_lines = file.readlines()  ## Read all the lines

I see your shadowing and raise you one obfuscation:

open = file(argv[1])          ## File the open given on the command line
all_lines = open.readlines()  ## Read all the lines





More information about the Python-list mailing list