Steve Holden <[EMAIL PROTECTED]> writes: > >>>[line.rstrip() for line in open('C:\\switches.txt')] > > How would I manually close a file that's been opened this way? Or is > > it not possible in this case? Is it necessary? > > In CPython it's not strictly necessary to close the file, but other > implementations don't guarantee that a file will be closed after the > last reference is deleted. > > So for fullest portability it's better explicitly close the file.
I wonder whether PEP 343 should be extended somehow. Hmm. [line.rstrip() for line within open('C:\\switches.txt')] # ugh!! Other ideas? -- http://mail.python.org/mailman/listinfo/python-list