3ewsd 发表于 2017-4-22 07:58:48

Python 字典替代case

# python code:
 
dosomething = {
  'A': dosomethingofA,
  'B': dosomethingofB,
  None: dosomethingofDefault,
}
 
dosomething.get(c,dosomething)()
页: [1]
查看完整版本: Python 字典替代case