Here's what I mean:
foo = 25
bar = (raw_input("foobar: "))
print bar
And if "foo" is used as input, I want it to print 25 instead of "foo". Is this possible? How can I do this?
(I'm currently working in Python 2.)
Here's what I mean:
foo = 25
bar = (raw_input("foobar: "))
print bar
And if "foo" is used as input, I want it to print 25 instead of "foo". Is this possible? How can I do this?
(I'm currently working in Python 2.)
Use the eval() command:
foo = 25
bar = eval(raw_input("enter 'foo': "))
print (bar)