python中没有类似java或c++中的“ ? : ”三元运算符,如果想用类似的结构,可以用if else来代替
x = 1 y = 2 res = 1 if x > y else 0 print(res)
输出为
0