摘要: 什么样的函数叫高阶函数:map(func, *iterables) --> map object 条件:1.函数接受函数作为参数 2.函数的返回值中包含函数 num_l = [1,2,3,4,5,6]b = map(lambda x:x**2,num_l)print(b)for i in b: pr 阅读全文
posted @ 2019-10-21 22:57 千焱 阅读(189) 评论(0) 推荐(0)
摘要: def foo(): print("foo",id(foo)) def bar(): print("bar",id(bar)) def inner(): print("inner",id(inner)) return inner return barprint(id(foo))bar = foo() 阅读全文
posted @ 2019-10-21 17:03 千焱 阅读(466) 评论(0) 推荐(0)
摘要: 用法:dict.update(dict2)dict立即改变!返回值是Nonea = {'a':1,'b':2,'c':3}b = {'d':4,'e':5}a.update(b)print(a)update方法的返回值是None,a立即改变了>>>{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}a = {'a':1,'b':2,'c':3} 阅读全文
posted @ 2019-10-21 12:50 千焱 阅读(862) 评论(0) 推荐(0)