file.close()

Bryan belred1 at yahoo.com
Thu Jul 24 07:20:15 CEST 2003


>
> If you need 50 open files, you almost certainly want to have a way of
> organizing them.  Probably they'll be in a list or dictionary.  So, if
> they're in a list, for example, you can do this:
>
>
>     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

bryan






More information about the Python-list mailing list