kriwil
10/7/2015 - 8:30 AM

switch_case_test.py

def switch_case_test():

    def one():
        print 'one'

    def two():
        print 'two'

    def three():
        print 'three'

    cases = {
        'one': one,
        'two': two,
        'three': three,
    }

    test = 'one'
    cases[test]()


switch_case_test()