import hashlib sign_msg = "password" #可以拼接id,时间和key等信息 sign_svr = hashlib.sha1(sign_msg.encode(encoding='utf-8')).hexdigest()