On Jan 9, 10:02 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Paul Hankin wrote: > > This can be more cleanly written using locals() > > > for fn in filenames: > > locals()[fn] = open(os.path.join(host_path, fname + '.txt', 'wb') > > from the reference manual: > > locals() > > Update and return a dictionary representing the current > local symbol table. > > Warning: The contents of this dictionary should not be > modified; changes may not affect the values of local > variables used by the interpreter.
Thanks Fredrik! I learnt something today. I wonder if there's a reason why it doesn't raise an exception when you try to write to it? That would seem better to me than having it sometimes update variables and sometimes not. -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list