相关疑难解决方法(0)

"如果a或b或c但不是全部"的Python语法

我有一个python脚本,可以接收零或三个命令行参数.(它可以在默认行为上运行,也可以需要指定所有三个值.)

什么是理想的语法:

if a and (not b or not c) or b and (not a or not c) or c and (not b or not a):
Run Code Online (Sandbox Code Playgroud)

python if-statement

128
推荐指数
10
解决办法
19万
查看次数

标签 统计

if-statement ×1

python ×1