[Tutor] How can I convert a variable name to a string?
Stephen Haywood
stephen at averagesecurityguy.info
Sat Sep 22 01:40:29 CEST 2012
On Sep 21, 2012, at 6:14 AM, Dae James <daedae11 at 126.com> wrote:
How can I convert a variable name to a string ?
For example:
testVariable = 1000;
How can I get the string "testVariable" ?
Thank you~
Use a dictionary.
vars['testVariable'] = 1000
for key in vars:
print key
print vars[key]
------------------------------
Dae James
_______________________________________________
Tutor maillist - Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120921/e7f4c4ac/attachment-0001.html>
More information about the Tutor
mailing list