variable hell

Peter Maas peter at somewhere.com
Thu Aug 25 09:47:37 EDT 2005


Nx schrieb:
> Hi
> 
>  I am unpacking a list into variables, for some reason they need to be
>  unpacked into variable names like a0,a1,a2....upto aN whatever is 
>  in the list.
> 
>  How to create the variables dynamically ?
> 
>  I am looking for something like 
>  pseudo code line follows :
> 
>  a%s = str(value)

 >>> suffix = 'var'
 >>> vars()['a%s' % suffix] = 45
 >>> avar
45

-- 
-------------------------------------------------------------------
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------



More information about the Python-list mailing list