Python编程:lambda替代品-operator模块

代码中不是很推荐使用 lambda表达式 取而代之的是 operator模块,提供了不少简单函数实现python 求和示例(基于Python3.5.6)web # -*- coding: utf-8 -*- import functools import operator lst = [1, 2, 3, 4, 5] # 使用 lamabda total = functools.reduce(
相关文章
相关标签/搜索