variables with dynamicly generated names

Diez B. Roggisch deets at nospam.web.de
Thu Dec 14 03:56:56 EST 2006


avlee schrieb:
> Hello
> 
> Is it possible to use in python variables with dynamicly created names ?
> How ?

In such cases, use a dictionary:

vars = {}

for some_name, some_value in some_values_generating_thing():
     vars[some_name] = some_value


Diez



More information about the Python-list mailing list