On 2006-07-18, T <[EMAIL PROTECTED]> wrote: >>> for line in file('foo', 'r'): >>> print line
>> Good programming practice says that if you open it - you close it. >> >> And stay out of trouble ;-) > How do I close the file in the above case? Aye, there's the rub. You can't close an anonymous file, so you have to give it a name. f = file('foo', 'r') for line in f: print line f.close() -- Grant Edwards grante Yow! The PILLSBURY at DOUGHBOY is CRYING for visi.com an END to BURT REYNOLDS movies!! -- http://mail.python.org/mailman/listinfo/python-list