a if condition else b
a = 2b = 5val = a if a > b else bprint(val) # 5
简单条件语句
if 条件: val = 1else: val = 2改成三元运算:
val = 1 if 条件成立 else 2