21.time和random
摘要:原文:https://www.cnblogs.com/yuanchenqi/article/5732581.html time模块 三种时间表示 在Python中,通常有这几种方式来表示时间: 时间戳(timestamp) : 通常来说,时间戳表示的是从1970年1月1日00:00:00开始按秒计算
阅读全文
posted @
2019-11-30 21:45
月零Ray
阅读(181)
推荐(0)
21.模块的执行以及__name__
摘要:执行结果: "E:\Program Files\JetBrains\PycharmProjects\python_demo\venv\Scripts\python.exe" "E:/Program Files/JetBrains/PycharmProjects/python_demo/day21/m
阅读全文
posted @
2019-11-29 22:20
月零Ray
阅读(130)
推荐(0)
21.python的模块(Module)和包(Package)
摘要:[TOC] 原文: "https://www.cnblogs.com/yuanchenqi/article/5732581.html" 模块(Module)和包(Package) 模块(modue)的概念 在计算机程序的开发过程中,随着程序代码越写越多,在一个文件里代码就会越来越长,越来越不容易维护
阅读全文
posted @
2019-11-29 20:50
月零Ray
阅读(355)
推荐(0)
21. 对文件进行查询修改等操作
摘要:练习目的: 1.函数编程 2.文件处理 3.tag的用法 4.程序的解耦 文件内容:haproxy.conf global log 127.0.0.1 local2 daemon maxconn 256 log 127.0.0.1 local2 info defaults log global mo
阅读全文
posted @
2019-11-29 20:18
月零Ray
阅读(183)
推荐(0)
20.装饰器和函数闭包
摘要:原文:https://www.cnblogs.com/linhaifeng/articles/6140395.html 1.装饰器 器即函数 装饰即修饰,意指为其他函数添加新功能 装饰器定义:本质就是函数,功能是为其他函数添加新功能 2.装饰器原则 1.不修改被装饰函数的源代码(开放封闭原则) 2.
阅读全文
posted @
2019-11-29 16:20
月零Ray
阅读(155)
推荐(0)
19.python基础试题(三)
摘要:转载: 老男孩 Python 基础知识练习(三):https://www.cnblogs.com/nulige/p/6128674.html 1、列举布尔值为 False 的值空,None,0, False, '', [], {}, () 2、写函数:根据范围获取其中 3 和 7 整除的所有数的和,
阅读全文
posted @
2019-11-28 20:42
月零Ray
阅读(659)
推荐(0)
19.生产者消费者模型
摘要:import time def consumer(name): print('我是[%s],我准备开始吃包子了' %name) while True: baozi=yield time.sleep(1) print('%s 很开心的把【%s】吃掉了' %(name,baozi)) def produ
阅读全文
posted @
2019-11-28 20:10
月零Ray
阅读(130)
推荐(0)
19.yield和send的区别
摘要:转载:https://www.jianshu.com/p/ccb5e7da3fd8 https://www.cnblogs.com/xhcdream/p/8304953.html https://www.cnblogs.com/wushuaishuai/p/9212812.html send方法和n
阅读全文
posted @
2019-11-28 12:05
月零Ray
阅读(258)
推荐(0)
18(19).迭代器协议和生成器
摘要:借鉴:https://www.cnblogs.com/lovezwfjc/p/9300031.html https://www.cnblogs.com/jianguo221/p/8977465.html 1.递归和迭代的区别 https://www.zhihu.com/question/202783
阅读全文
posted @
2019-11-24 22:05
月零Ray
阅读(299)
推荐(0)
18.函数复习,文件处理b模式(二进制处理),文件处理其他高级玩法
摘要:1.函数复习 # map # l = [1,2,3,4,5] # print(list(map(str,l))) # reduce # l = [1,2,3,4,5] # from functools import reduce # print(reduce(lambda x,y:x+y,l,3))
阅读全文
posted @
2019-11-24 17:57
月零Ray
阅读(263)
推荐(0)
17.python文件处理
摘要:原文:https://www.cnblogs.com/linhaifeng/articles/5984922.html 文件处理流程: 1. 打开文件,得到文件句柄并赋值给一个变量2. 通过句柄对文件进行操作3. 关闭文件 #1. 打开文件的模式有(默认为文本模式): r ,只读模式【默认模式,文件
阅读全文
posted @
2019-11-07 19:38
月零Ray
阅读(173)
推荐(0)
17.python内置函数2
摘要:python内置函数1:https://www.cnblogs.com/raitorei/p/11813694.html # max,min高级玩法 # l=[1,3,100,-1,2] # print(max(l)) # print(min(l)) # # # print(list(zip(('a
阅读全文
posted @
2019-11-07 18:39
月零Ray
阅读(210)
推荐(0)
16.python内置函数
摘要:Python 内置函数:https://www.runoob.com/python/python-built-in-functions.html 原文:https://www.cnblogs.com/linhaifeng/articles/6113086.html#_label12 # 绝对值 #
阅读全文
posted @
2019-11-07 17:37
月零Ray
阅读(184)
推荐(0)
16python的map函数,filter函数,reduce函数
摘要:map num_l = [1,6,8,9] def map_test(func,array): ret = [] for i in array: res = func(i) ret.append(res) return ret def jia(x): return x+1 #内置函数 print(m
阅读全文
posted @
2019-11-06 01:45
月零Ray
阅读(197)
推荐(0)
递归蝌蚪找妈妈
摘要:import time animals_list = ['鲤鱼','乌龟','青蛙'] def find_mother(animals_list): time.sleep(1) animal = animals_list.pop(0) print('你好%s,你是我的妈妈么'%animal) tim
阅读全文
posted @
2019-11-05 20:22
月零Ray
阅读(101)
推荐(0)