A variables variables

Benjamin musiccomposition at gmail.com
Sat Aug 23 21:10:50 EDT 2008


On Aug 23, 7:25 pm, Gandalf <goldn... at gmail.com> wrote:
> how can I declare a variable with another variable  name?
>
> for example  I will use PHP:
>
> $a= "hello";
>
> $a_hello="baybay";
>
> print ${'a_'.$a)  //output: baybay

Doing this sort of thing in Python is very anti idiom.
>
> how can i do it with no Arrays using  python

Why would you not want to use a list? I see no reason not to.
>
> thanks!




More information about the Python-list mailing list