What are Python's equivalent of Javascript's reduce(), map(), and filter()?

前端 未结 3 703
轮回少年
轮回少年 2021-01-31 10:27

What are Python\'s equivalent of the following (Javascript):

function wordParts (currentPart, lastPart) {
    return currentPart+lastPart;
}

word = [\'Che\', \'         


        
3条回答
  •  一个人的身影
    2021-01-31 11:14

    reduce(function, iterable[, initializer])
    
    filter(function, iterable)
    
    map(function, iterable, ...)
    

    https://docs.python.org/2/library/functions.html

提交回复
热议问题