Python 实现Switch功能 def case1(somearg): pass def case2(somearg): pass def case3(somearg): pass switch={ 1: case1, 2: case2, 3: case3 } switch[case](arg)