Programming/Python
function dic
알 수 없는 사용자
2008. 5. 11. 02:07
Functions as object
switch = {
'one' : function1,
'two' : function2,
'three' : function3
}
try:
result = switch[choice]
except KeyError :
print 'I didn't understand your choice.'
else :
result ()
switch = {
'one' : function1,
'two' : function2,
'three' : function3
}
try:
result = switch[choice]
except KeyError :
print 'I didn't understand your choice.'
else :
result ()