小编gab*_*f97的帖子

python-如何在案例中使用间隔创建python的切换案例?

我是python的新手,我想创建一个switch case,其中case可以将间隔作为条件,例如:

switch = {
    1..<21: do one stuff,
    21...31: do another
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能达到这个结果?

python switch-statement python-3.x

1
推荐指数
1
解决办法
62
查看次数

标签 统计

python ×1

python-3.x ×1

switch-statement ×1