您的位置: 首页 > IT文章 > 三元表达式--python 三元表达式--python 分类: IT文章 • 2023-11-27 10:34:30 if a>b: print(b,a) else: print(a,b) 等价于: print(b,a) if a>b else print(a,b) 备注:print(b,a)多余两行就不能用三元运算符