Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

stupid python question

Name: beginner 2010-08-25 11:06

Simple (I think?) Python problem here.

Is there anyway to use a string the user inputs as a variable?

e.g., if a user inputs "var1", how can I then go and call something(var1) without using if/elif.

Here is a longer example of what I want to do; get the user to define "NATION" and then assign a random name from that nation's set of names.

http://pastebin.com/cHL9NqqX

The actual thing I'm writing will have tons of nationalities, so I'm hoping to skip the huge elif tree that would result.

Name: Anonymous 2010-08-25 14:05

All questions about Python are stupid.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List