I want to convert this string into a byte scheme:
www.google.de
So the output should look like:
\x77\x77\x77\x2e\x67\x6f\x6f\x67\x6c\x65\x2e\x64\x65\x2f\x62\x6d\x70\x2e\x62\x6d\x70
I tried things like:
a = ''.join(hex(ord(x))[2:] for x in data)
which gave me
>>> 7777772e676f6f676c65
I also tried:
b = [hex(ord(i)) for i in data[:]]
which resulted in:
>>> ['0x77', '0x77', '0x77', '0x2e', '0x67', '0x6f', '0x6f', '0x67', '0x6c', '0x65']
But this is a list, and I need a bytesarry, which looks more like the one I mentioned above. Also to give a bigger picture: I want to send a bytestream of data to an ATTINY microcontroller and it cannot handle strings, only a bytestream.