摘要:
class Person(object): def __init__(self, age): self.age = age @property def age(self): print('i am the get age of Person ...') return self._age @age.s 阅读全文
摘要:
# lambda,filter,map,reduce from functools import reduce print('返回一个迭代器') print((x) for x in range(5)) print('迭代器转换为tuple') print(tuple((x) for x in ra 阅读全文
摘要:
闭包:当有函数嵌套时,内部函数被保存到外部时会产生闭包。 def A(): # print('this is A function') a = 0 def B(): # B里面的参数a是声明在B函数外的,所以要修改a的值需要先执行nonlocal a nonlocal a a += 1 print( 阅读全文
摘要:
import json result = [] def NBFS(dict_str:dict,target_list:[str]) -> [str]: ''' 输入dict类型的数据,已经对应的key,返回[str] ''' x = '' try: for i in range(len(target 阅读全文