hash
hash是一类的算法,该算法接受传入的内容,经过一系列运算得到一系列哈希值。
hash值的特点
1.传入内容一致,得到hash值必然一样
2.不能反解出内容
3.只要hash算法不变,无论校验内容有多大,得到的hash值长度固定
hashlib模块
import hashlib
m = hashlib.md5()
m.update('hello'.encode('utf-8'))
m.update('world'.encode('utf-8'))
m.update(b'!')
m.hexdigest()
subprocess摸快
import subprocess
obj = subprocess.Popen('dir /Work',shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
res_true = obj.stdout.read()
print(res_true.decode('gbk')
res_flase = obj.stderr.read()
print(res_flase.decode('gbk'))