三元运算
result = 值 1 if 条件 else 值 2
a=9b=5c = 8 if a <b else 99print(c)99a=8b=5c = 8 if a < b else 99print(c)8
比较两个数输出最大的数
a=8b=5c = a if a> b else bprint(c) 8
来源: http://www.bubuko.com/infodetail-2567418.html