Desactivating Python keywords and built-in functions
Sridhar R
sridharinfinity at gmail.com
Fri Oct 8 21:44:26 EDT 2004
Don't read code as input.
Instead read `data` from user. If control of that data must be also
read as input, then read `action` key from user, from which get the
method using dictionary.
def foo_do(a,b):
print a,b
actions = {
'do_this': foo_do
...
}
data = raw_input()
a,b = data.split(',')
control = raw_input()
actions[control](a,b)
More information about the Python-list
mailing list