import secrets secret_key = secrets.token_hex(16) # 生成一个长度为16字节的随机十六进制字符串 print(secret_key)