Desactivating Python keywords and built-in functions

Sridhar R sridharinfinity at gmail.com
Sat Oct 9 03:44:26 CEST 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