python if else 几种用法
a, b, c = 1, 2, 3
# 1.常规
if a > b:
c= a
else:
c= b
# 2.表达式
c =a if a>b else b
# 3.二维列表
c = [b, a][a > b]
# 4.???
c = (a>b and [a] or [b])[0]
a, b, c = 1, 2, 3
# 1.常规
if a > b:
c= a
else:
c= b
# 2.表达式
c =a if a>b else b
# 3.二维列表
c = [b, a][a > b]
# 4.???
c = (a>b and [a] or [b])[0]