赞
踩
a = x if M else y 首先对M求值,如果结果为真,则a=x;如果结果为假,则a=y
a = 1 if True else 0 print(a) # 1 a = 1 if False else 0 print(a) # 0