[Tutor] Trying to extract the last line of a text file

Jordan Greenberg jordangreenberg at gmail.com
Thu Oct 19 21:26:51 CEST 2006

Chris Hengge wrote:
> Not to hijack the thread, but what stops you from just putting a
> file.close()
> after your example line?

Because file is a class.
file(filename) creates a file object, but he's not saving the object to
a variable, so its lost. file.close() takes a file object as a
parameter, but theres no object left to pass it.

-Jordan Greenberg

More information about the Tutor mailing list