Detailed examples of python3.4 string to hexadecimal
- 2021-06-28 13:05:09
- OfStack
As follows:
def str_to_hex(s):
s = s.split(' ')
send_buf = b''
for i in range(len(s)):
send_buf += struct.pack('B',int(s[i],16))
return(send_buf)