2019年3月26日

Python switch(多分支选择)的实现

摘要: Python 中没有 switch/case 语法,如果使用 if/elif/else 会出现代码过长、不清晰等问题。 而借助字典就可以实现 switch 的功能 示例: def case1(): # 第一种情况执行的函数 print('This is the case1') def case2() 阅读全文

posted @ 2019-03-26 16:48 doubtful 阅读(110362) 评论(0) 推荐(3) 编辑

导航