changing a strig to a variable

Paul Rubin phr-n2001d at nightsong.com
Tue Oct 9 18:07:38 CEST 2001


"Raibatak Das" <rd54 at cornell.edu> writes:
> this might be a silly question but i would greatly appreciate an answer.
> is there any way to convert a string to a variable name. that is, suppose
> i have x = 'var' and i want to do, say, var=13 is there an easy way to do
> so?

vars()[x]=13




More information about the Python-list mailing list