摘要: 原文链接:https://www.cnblogs.com/zhou2019/p/10582716.html subprocess 是Python 2.4中新增的一个模块,它允许你生成新的进程,连接到它们的 input/output/error 管道,并获取它们的返回(状态)码。这个模块的目的在于替换 阅读全文
posted @ 2019-11-01 22:05 wztshine 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 1. hashlib:MD5,sha256,sha512 import hashlib # ######## md5 ######## hash = hashlib.md5() hash.update('admin'.encode()) print(hash.hexdigest()) # ##### 阅读全文
posted @ 2019-11-01 21:07 wztshine 阅读(258) 评论(0) 推荐(0) 编辑
摘要: import sys import time # 打印消息,类似print,但是不会换行(print实际是调用此方法,只是默认会换行) sys.stdout.write('abcde') sys.stdout.write('fghijk') sys.stdout.write('\rAAAA') # 阅读全文
posted @ 2019-11-01 19:09 wztshine 阅读(160) 评论(0) 推荐(0) 编辑
摘要: import random print(random.random()) # 0< x <1 的浮点数 print(random.uniform(1,5)) # 1<x <5 的浮点数 print(random.randint(1,2)) # 1<= x < =2 的整数 print('jiii', 阅读全文
posted @ 2019-11-01 16:56 wztshine 阅读(229) 评论(0) 推荐(0) 编辑
摘要: import os path = os.getcwd() os.getcwd() #获取当前工作目录,即当前python脚本工作的目录路径 os.chdir(path) #改变当前脚本工作目录 os.curdir #返回当前目录: ('.') os.pardir #获取当前目录的父目录字符串名:(' 阅读全文
posted @ 2019-11-01 16:45 wztshine 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 时间的三种格式: 1)时间戳 2)格式化的时间字符串 3)元组(struct_time):time.struct_time(tm_year=1970, tm_mon=5, tm_mday=23, tm_hour=20, tm_min=7, tm_sec=14, tm_wday=5, tm_yday= 阅读全文
posted @ 2019-11-01 16:35 wztshine 阅读(168) 评论(0) 推荐(0) 编辑