运维网's Archiver
论坛
›
Python
› Python 字典替代case
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