def dotask():
    print "Task done..."

def returnvalue():
     return "Awesome"

cmd = raw_input("Your command: ")
eval(cmd + "()")

I know that you can't use eval to assign a value to a variable. but is it the best way to have user input be performing a function?

For example:
I put "dotask" in raw input, it will print "Task done..."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.