Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def foo1():
- print("foo1 running...")
- return 1
- def foo2():
- print("foo2 running...")
- return 2
- def foo3():
- print("foo3 running...")
- return 3
- def default():
- print("default running...")
- return 0
- option="case3"
- result = {
- 'case1': foo1,
- 'case2': foo2,
- 'case3': foo3,
- 'default': default,
- }.get(option)()
- print(result)
Add Comment
Please, Sign In to add comment