python即将支持 switch 功能

MicroPython、microbit、makecode等
最新动态
回复
头像
shaoziyang
帖子: 3917
注册时间: 2019年 10月 21日 13:48

python即将支持 switch 功能

#1

帖子 shaoziyang »

整理自:https://hackaday.com/2021/04/02/python- ... tatements/

在C语言中用if else和switch语句执行状态处理

图片

python中新增了 match 功能,可以看成是 switch 2.0。

图片

支持模糊匹配

图片

甚至是组合

图片

还可以包括比较

图片

这个功能将在2021 年 10 月 4 日发布 Python 3.10 中启用,或者在Python 3.10.0a6测试版中体验。

 

oyster
帖子: 63
注册时间: 2021年 3月 2日 20:06

Re: python即将支持 switch 功能

#2

帖子 oyster »

早知如此,何必当初

回复

  • 随机主题
    回复总数
    阅读次数
    最新文章