摘要:
该模块基本都是生成迭代器,需要用list 之类的把东西放进去 1. chain() 把 list/tuple/set/iterables 连在一起,返回课迭代对象 array = [1, 10, 9, 12, 3, 4] import itertools print(list(itertools.c 阅读全文
2020年7月14日
2020年7月11日
摘要:
1. 返回列表中出现最多的数字, 如果出现的次数一样多,返回数值大的那个 def highest_rank(arr): a = max([arr.count(i) for i in arr]) b = set() for i in arr: if arr.count(i) == a: b.add(i 阅读全文
2020年7月2日
摘要:
一、mac 环境下的 SQL 学习 https://zhuanlan.zhihu.com/p/34432866 1. SQL 的keyword 不能作为表或列的名字 2. 语句结束需要用; 结尾 3. 不区分大小写 4. 空格被忽略, 多行 ,一行都是可以的 二、检索数据 0. 注释 -- # /* 阅读全文
2020年6月30日
2020年6月28日
摘要:
1. Your goal in this kata is to implement a difference function, which subtracts one list from another and returns the result. It should remove all va 阅读全文
2020年6月27日
2020年6月26日
摘要:
1. 引入模块 from module import do_module # 若引入的文件在同级文件夹的下面,要这么写,从执行文件的下一级开始写路径 from web.web1.web2.import cal # 包与包之间用点来联系 do_module.run() 引用do_module 中的函数 阅读全文
摘要:
1. __main__ 用法存疑 if __name__ == '__main__': # 用于被调用文件的测试 print('ok') a = add(5,7) print(a) if __name__ == '__main__': # 不想文件被其他人调用 main.run() 阅读全文
2020年4月22日
摘要:
一、 函数 1. 函数的嵌套 1 def huangwei(): # 函数不能里面执行不执行外面 2 name = 'huang' 3 print(name) 4 5 def liuyang(): 6 name = 'liuyang' 7 print(name) 8 9 def nulige(): 阅读全文
2020年4月21日
摘要:
1. reduce(function, sequence[, initial]) -> value 意思就是对sequence连续使用function, 如果不给出initial, 则第一次调用传递sequence的两个元素, 以后把前一次调用的结果和sequence的下一个元素传递给functio 阅读全文