摘要:
map()函数 map(function, iterable,...) >>> import map # 计算平方 >>> list(map(lambda: x: x**2, [1,2,3,4,5])) # 使用 lambda匿名函数 [1,4,9,16,25] # 提供了两个列表,对相同位置的列表 阅读全文
posted @ 2022-09-07 15:10
是阿杰呀
阅读(36)
评论(0)
推荐(0)
摘要:
operator 模块 python2.x版本中, 使用 **cmp()函数来比较两个列表, 数字, 字符串等的大小关系 python3.x版本中已经没有cmp()**函数, 需要引入 operator模块 lt < le <= gt > ge >= eq == ne != x = 10 y = 2 阅读全文
posted @ 2022-09-07 15:05
是阿杰呀
阅读(41)
评论(0)
推荐(0)
摘要:
math模块一些用法 trunc(x) 传入整数或浮点数, 返回 数值的整数部分, 忽略小数部分,不会四舍五入 import math math.trunc(2.77) # 2 math.trunc(8.32) # 8 math.trunc(-99.99) # -99 阅读全文
posted @ 2022-09-07 14:36
是阿杰呀
阅读(76)
评论(0)
推荐(0)

浙公网安备 33010602011771号