上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 83 下一页

2020年4月19日

【黑马】python单例模式

该文被密码保护。 阅读全文

posted @ 2020-04-19 18:00 芦荟~lh 阅读(22) 评论(0) 推荐(0) 编辑

类属性和实例属性的区别

摘要: 来自:https://blog.csdn.net/sehanlingfeng/article/details/92415782 # 类属性和实例属性 class Student: count = 10 # count是类属性 def __init__(self, name): self.name = 阅读全文

posted @ 2020-04-19 17:39 芦荟~lh 阅读(1194) 评论(0) 推荐(0) 编辑

统计字典或者json字符串最大深度

摘要: # 统计字典或者json字符串的深度 def depth(x): if type(x) is dict and x: return 1 + max(depth(x[a]) for a in x) if type(x) is list and x: return 1 + max(depth(a) fo 阅读全文

posted @ 2020-04-19 17:19 芦荟~lh 阅读(397) 评论(0) 推荐(0) 编辑

python中join函数

摘要: https://www.cnblogs.com/sui776265233/p/10755525.html 阅读全文

posted @ 2020-04-19 16:35 芦荟~lh 阅读(106) 评论(0) 推荐(0) 编辑

python实现反转字符串

摘要: https://www.cnblogs.com/taceywong/p/8045127.html 阅读全文

posted @ 2020-04-19 16:30 芦荟~lh 阅读(120) 评论(0) 推荐(0) 编辑

map函数

摘要: # map函数 # 是一个内置函数,把一个函数调用应用于可迭代对象的每一项 # 类似于列表解析,但是没有列表解析灵活,因为这里必须是对迭代项应用函数 # 列表解析则是可以对迭代项应用任意的表达式 # map函数是一个迭代器,也需要用list来接收所有的迭代结果 # 对文件中的每一个字符转成大写 li 阅读全文

posted @ 2020-04-19 16:27 芦荟~lh 阅读(145) 评论(0) 推荐(0) 编辑

python中lambda函数

摘要: https://www.cnblogs.com/evening/archive/2012/03/29/2423554.html 阅读全文

posted @ 2020-04-19 16:24 芦荟~lh 阅读(179) 评论(0) 推荐(0) 编辑

python中reduce函数

摘要: 取可迭代对象中的两个项,运行一个函数 https://www.runoob.com/python/python-func-reduce.html 阅读全文

posted @ 2020-04-19 16:21 芦荟~lh 阅读(149) 评论(0) 推荐(0) 编辑

python实现斐波那契数列

摘要: 通过生成器方式 def fib_loop_while(max): a, b = 0, 1 while max > 0: a, b = b, a + b max -= 1 yield a for i in fib_loop_while(10): print(i) 阅读全文

posted @ 2020-04-19 16:04 芦荟~lh 阅读(150) 评论(0) 推荐(0) 编辑

2020年4月18日

迭代器和生成器

摘要: https://zhuanlan.zhihu.com/p/76831058 一、迭代器 1.可迭代对象: 理解1【概念】:定义了__iter__方法的对象,调用该方法会返回一个迭代器对象。字符串、list、元组、字典都是可迭代对象 理解2【意义】:实际保存的序列和在迭代工具环境中一次产生一个结果的对 阅读全文

posted @ 2020-04-18 21:34 芦荟~lh 阅读(93) 评论(0) 推荐(0) 编辑

上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 83 下一页

导航