摘要:
ret = map(abs,[-1,1,2,3]) print(ret) for i in ret: print(i) l = [1,-2,3,6,8,-7] l.sort(key=abs) print(l)
阅读全文
posted @ 2019-03-11 22:14
开心小耀子
阅读(72)
推荐(0)
编辑
摘要:
def is_odd(x): return x % 2 == 1 ret = filter(is_odd, [1,4,6,7,9]) print(ret) for i in ret: print(i) def is_str(s): return type(s) == str ttt = filter(is_str, [1, 'hello']) print(ttt...
阅读全文
posted @ 2019-03-11 21:41
开心小耀子
阅读(145)
推荐(0)
编辑