On Sep 21, 2012, at 6:14 AM, Dae James <daeda...@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@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor