String as a Variable?

binnc at my-deja.com binnc at my-deja.com
Fri Feb 2 10:08:31 EST 2001


Another newbie question...

Is there a way to have a string represent a variable.

For eaxample, I have a the following:

<snip>

serial_number = '3'
print 'ip_address_serial_' + serial_number
ip_address_serial_3

Now I want to use the string ip_address_serial_3 to pull
the value assigned to the variable of the same name.

How can I represent the string as a variable?

Thanks in advance!


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list