reduce map filter 三种函数的详细用法

from functools import reduce
sentences = ['The Deep Learning textbook is a resource intended to help students and practitioners enter the field of machine learning in general and deep learning in particular. '] 
word_count =reduce(lambda a,x:a+x.count("learning"),sentences,0)
print(word_count)
 

猜你喜欢

转载自www.cnblogs.com/yvlicai/p/9445989.html