摘要: 实现代码如下: #多线程 import threading import time class test: def test1(self,a): for i in range(3): print(a) time.sleep(2) def test2(self,b): for i in range(5 阅读全文
posted @ 2020-01-11 21:10 badbadboy 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 实现代码如下: #多进程 import time import multiprocessing class test: def test1(self,a): for i in range(3): print(a) time.sleep(1) def test2(self,b): for i in r 阅读全文
posted @ 2020-01-11 20:14 badbadboy 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 一、读写模式: w:向文件中写入内容,w会清空原来文本内容 a:向文件中追加内容 r:从文件中读取内容 wb:以二进制形式写入内容。 rb:以二进制形式读文件内容 ab:以二进制形式追加内容 a+、r+、w+:混合形式,即可读可写 二、读 1. 方法一: f = open(文件路径,读模式) #将文 阅读全文
posted @ 2020-01-11 19:22 badbadboy 阅读(701) 评论(0) 推荐(0) 编辑
摘要: #封包 def as1(*a): print(a) as1(1,2,3) #解包 def as2(a): print(*a) as2([1,2,3]) 阅读全文
posted @ 2020-01-11 19:13 badbadboy 阅读(481) 评论(0) 推荐(0) 编辑
摘要: #time库 import time #线程推迟时间 time.sleep(3) #时间戳 print(time.time()) #返回日期、时间、星期 print(time.strftime('%Y/%m/%d %H:%M:%S %A')) #返回时间信息元祖 print(time.localti 阅读全文
posted @ 2020-01-11 19:05 badbadboy 阅读(554) 评论(0) 推荐(0) 编辑