标签:迭代器 false int 保存 turn 过滤 documents 调用 library
def add(a): return a%2==0 print(list(filter(add,[1,2,3,4]))) /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 /Users/dongyf/Documents/python/besttest_study/cnz/ycc/a.py [2, 4]
filter与lambda结合使用
stu_score = {‘xiaobai‘:50,‘xiaohei‘:30,‘xiaolan‘:80,‘xiaojun‘:100, ‘xiaoming‘:60} result=filter(lambda score:score>60,stu_score.values()) print(list(result)) /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 /Users/dongyf/Documents/python/besttest_study/cnz/ycc/a.py [80, 100]
标签:迭代器 false int 保存 turn 过滤 documents 调用 library
原文地址:https://www.cnblogs.com/xiaokuangnvhai/p/11062090.html