2021年4月15日

摘要: 1、Python自带多线程模块 _thread _thread.start_new_thread(function, (参数元组)), function结束,线程也结束 2、第三方模块 threading, 要重写 init 和 run() import threading class A(thre 阅读全文
posted @ 2021-04-15 16:31 wolun666 阅读(116) 评论(0) 推荐(0) 编辑
 
摘要: 1、 a = b # 复制地址 a = b[ : ] #复制值 2、使用 sys.stdin.readlines()时,停止输入 windowns下使用 ctrl+z , Linux下使用 ctrl+d 以此种方式返回值包含'\n',input()方式不会有,但一个Enter即止 3、 while 阅读全文
posted @ 2021-04-15 15:56 wolun666 阅读(44) 评论(0) 推荐(0) 编辑
 
摘要: 1、1bit就是一个二进制位, 1或0 8bit = 1Byte(1字节) = 1个数字[-128~127] = 一个字母 = 0.5个汉字 int = 4Byte char = 1Byte char* = 4Byte 2、Ascii code 是1个字节, unicode 是2个, 非常生僻的是4 阅读全文
posted @ 2021-04-15 15:39 wolun666 阅读(51) 评论(0) 推荐(0) 编辑
 
摘要: cf = configparser.ConfigParser() cf.read('文件名') ## 读取 cf.sections() cf.options(section) cf.items(option) cf.get(section, option) cf.getint(section, op 阅读全文
posted @ 2021-04-15 15:22 wolun666 阅读(35) 评论(0) 推荐(0) 编辑
 
摘要: from datetime import datetime datetime.now() #当前时间 datetime.now.strftime('%Y-%m-%d %H:%M:%S') 计算时间差 from datetime import datetime t2 = datetime.now() 阅读全文
posted @ 2021-04-15 15:14 wolun666 阅读(43) 评论(0) 推荐(0) 编辑
 
摘要: secrets 替代 random import secrets num = secrets.below(10) random_num = secrets.SystemRandom().randint(0, 50) # 取0-50间的整型 random_num = secrets.SystemRan 阅读全文
posted @ 2021-04-15 14:51 wolun666 阅读(122) 评论(0) 推荐(0) 编辑