if a>b:
print(b,a)
else:
print(a,b)
等价于:
print(b,a) if a>b else print(a,b)
备注:print(b,a)多余两行就不能用三元运算符
posted on 2018-11-24 20:18 smileBB 阅读(116) 评论(0) 编辑 收藏 举报