Dynamic variable names ... with imported libraries.

Anton Muhin antonmuhin at sendmail.ru
Thu May 15 06:43:57 EDT 2003


Loko wrote:
[skipped]

 >>> import time
 >>> time.__dict__["foo"] = "bar"
 >>> time.foo
'bar'
 >>> setattr(time, "foo2", "bar2")
 >>> time.foo2
'bar2'
 >>>

hth,
anton.





More information about the Python-list mailing list