I'm picking this up as a hobby really, not having done any programming since Acorn I'm pretty much starting form scratch (and even back in the BASIC day I never really got to grips with files). This is from Alan Gauld's Learning to Program: Handling Files. http://www.freenetpages.co.uk/hp/alan.gauld/
<http://www.freenetpages.co.uk/hp/alan.gauld/>Can I just check I'm getting it? *Menu.txt contains* *Spam & Eggs* *Spam & Chips* *Spam & Spam* >>>inp = file("menu.txt", "r") *What is inp? What does it now contain?* *The following creates a list;* * * * >>>print inp.readlines() ['spam & eggs\n', 'spam & chips\n', 'spam & spam'] but if I do it again I get: >>> print inp.readlines() [] I'm baffled, why is inp now empty? Many thanks Neil ps. I'm working in the IDLE Python Shell. * * * * * * * * * This email is confidential and intended for addressee only .
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor