I am writing a code
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
............continue
and because of line 2 i am getting this error
**binary = bin(int(binascii.hexlify(message), 16))
TypeError: a bytes-like object is required, not 'str'
i dont understand this error and nothing seems to work
The variable message
contains a string, but it needs to be a sequence of bytes. To encode a string into bytes, you can do something like this:
message.encode('utf-8')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.