file.close()
Ben Finney
bignose-hates-spam at and-benfinney-does-too.id.au
Thu Jul 24 01:26:15 EDT 2003
On Thu, 24 Jul 2003 05:20:15 GMT, Bryan wrote:
>> filelist = []
>> try:
>> filelist.append(open(filename[0]))
>> filelist.append(open(filename[1]))
>> ...
>> do_something(filelist)
>> finally:
>> for f in filelist:
>> f.close()
>
> erik, carl... thanks... this is exactly what i was looking for
The only substantial difference I see between this and what you
originally posted, is that there is only one 'try...finally' block for
all the file open/close operations. Is this what you were wanting
clarified?
--
\ "I spent all my money on a FAX machine. Now I can only FAX |
`\ collect." -- Steven Wright |
_o__) |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B
More information about the Python-list
mailing list