随笔分类 -  leetcode-python

摘要:def fib(n): a,b,count=0,1,0 while True: if count>n: return yield a a,b=b,a+b count +=1# 迭代器有两个基本的方法:iter() 和 next()。# 迭代器是访问元素的一种方式# 字符串,列表或元组对象都可用于创建 阅读全文
posted @ 2020-06-03 11:19 不带R的墨菲特 阅读(254) 评论(0) 推荐(0) 编辑
摘要:import os import shutil # todo python 递归算法 def copy(src,dest): files=os.listdir(src) os.mkdir(dest) for file in files: src_file_path= os.path.join(src 阅读全文
posted @ 2020-03-12 16:28 不带R的墨菲特 阅读(336) 评论(0) 推荐(0) 编辑
摘要:a= [80, 46, 21, 18, 79, 78, 95, 7, 91, 4] length = len(a) for i in range(length): for j in range(length-1-i): if a[j]>a[j+1]: a[j],a[j+1]=a[j+1],a[j] 阅读全文
posted @ 2020-03-12 16:22 不带R的墨菲特 阅读(141) 评论(0) 推荐(0) 编辑
摘要:我们知道,Python 类是支持(多)继承的,一个类的方法和属性可能定义在当前类,也可能定义在基类。针对这种情况,当调用类方法或类属性时,就需要对当前类以及它的基类进行搜索,以确定方法或属性的位置,而搜索的顺序就称为方法解析顺序。方法解析顺序(Method Resolution Order),简称  阅读全文
posted @ 2020-03-09 09:16 不带R的墨菲特 阅读(611) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示