这是我的密码
if __name__ == "__main__":
key = "0123456789abcdef0123456789abcdef".decode('hex') /this line is having error
plain_1 = "1weqweqd"
plain_2 = "23444444"
plain_3 = "dddd2225"
print(plain_1)
print(plain_2)
print(plain_3)
cipher = Present(key)
输出
AttributeError: 'str' object has no attribute 'decode'
这是因为你试图解码一个字符串。
bytes
类型可以解码,但不能str
类型。您应该在此之前对(key.encode()
)进行编码(或使用b"foo"
),以将字符串转换为bytes
对象。相关问题 更多 >
编程相关推荐