我在写代码
image = Image.open(filename) #opening the image
binary = bin(int(binascii.hexlify(message), 16)) #converting string into binary
binary = binary.append('1111111111111110') #adding delimeter at the end
binary = binary**.lstrip('0b') #removing the starting ob of binary
............继续
由于第二行,我收到此错误
** binary = bin(int(binascii.hexlify(message),16))
TypeError:需要一个类似字节的对象,而不是'str'
我不明白这个错误,似乎没有任何工作
该变量message
包含一个字符串,但是它必须是字节序列。要将字符串编码为字节,可以执行以下操作:
message.encode('utf-8')
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句