Open a List of Files

Tim Chase python.list at
Wed Jan 9 15:40:33 CET 2008

> You don't need "for fn in open_files.keys():", you can just use "for fn in
> open_files:", but simpler than that is to just use the dictionary values:
> for fn in open_files.values():
>     fn.close()

This can also work for standard variable names:

   for f in (messages, deliveries, actions, parts,
       recipients, viruses, esp_scores):


More information about the Python-list mailing list