1 #三元运算,三目运算,if else简写 2 if 1 == 1: 3 name = "liangml" 4 else: 5 name = "NB" 6 #如果 1==1 成立,name = ”liangml“ 否则 name = "NB" 7 name = "liangml" if 1 == 1 else "NB"#三元运算 8 #lambda表达式 9 def f1(a1): 10 return a1 + 100 11 12 f2 = lambda a1: a1 + 100#默认已经有return 13 14 ret = f1(10) 15 print(ret) 16 17 r2 = f2(9) 18 print(r2)