python的switch语句
dipswitch的Python项目详细描述
双列直插式组件开关
dipswitch是一个python模块,允许使用 与本机支持它们的语言中的结构相似。
用法
from dipswitch import switch
for case in switch(2):
if case(0):
print("doesn't execute")
if case(1):
print("doesn't execute")
break
if case(2):
print("executes")
if case(3):
print("executes")
break
if case(4):
print("doesn't execute")
break
if case.default():
print("doesn't execute")