variable variables

pyth at relax.dk pyth at relax.dk
Mon Dec 11 06:52:21 EST 2000


Allright! thanx :o)
I hadn't thought of that :o)
I'm still a python newbie, and didn't use that kinda expressions in php
:o)
Thanx again :o)


> You could:
> 
> exec "print test%d" % (var1)
> 
> > What i was thinking of, was something like this:
> > 
> > test1 = 'test text 1';
> > test2 = 'test text 2';
> > 
> > var1 = 1
> > var2 = 2
> > 
> > print test{var1};
> > 
> > This should print: 'test text 1'
> > This example doesn't work, but is close how you would do it in php :o)
> > 

/Dan Larsen





More information about the Python-list mailing list