time模块
打印三种不同格式的时间
time.time() # 打印当前时间(秒) time.sleep() # 睡眠
datetime模块
修改时间
datetime.datetime.now() + datetime.timedelta(3)
hashlib模块
加密
m = hashlib.md5() m.update(b'hello') m.update(b'hello') print(m.hexdigest()) m = hashlib.md5() m.update(b'hellohello') print(m.hexdigest())
- 结果永远都是相同长度的字符串
- 叠加性
hmac模块
加密, 加盐处理
m = hmac.new(b'123') m.update(b'hellow') print(m.hexdigest())