https://blog.csdn.net/weixin_35757704/article/details/90234427
#for简写 alist = ["123", "456"] [print(i) for ylist in alist for i in ylist] #if简写 y = 1 x = 1 if y > 0 else -1 print(x) #for if 简写组合 x = [1,2,3,4,5,6,7] [print(i) for i in x if i > 3 ] #map 用法 def sp(x): return 2*x alist = [1,2,3,4,5] b = map(sp,alist) print(list(b)) #lambda 用法 x = 3 b = (lambda k: k+3)(x) print(b) #map lambda组合 c = list(map(lambda x: x * 2, [1, 2, 3, 4, 5])) print(c)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)