摘要: python把函数作为参数 import math def add(x, y, f): return f(x) + f(y) print add(25, 9,math.sqrt) python中map()函数的应用。将首字母大写,其他的小写 def format_name(s): return s. 阅读全文
posted @ 2020-05-20 14:15 topass123 阅读(1161) 评论(0) 推荐(0) 编辑
摘要: 关键字lambda 表示匿名函数,冒号前面的 x 表示函数参数。 def is_not_empty(s): return s and len(s.strip()) > 0 filter(is_not_empty, ['test', None, '', 'str', ' ', 'END']) 修改为: 阅读全文
posted @ 2020-05-20 14:13 topass123 阅读(136) 评论(0) 推荐(0) 编辑