简化的二分支写法 表达式1 if 条件 else 表达式2 如下例 >>> a = 1 >>> 1 + 1 if a == 1 else 2+ 2 2 >>> 1 + 1 if a != 1 else 2+ 2 4