当前位置:主页 > 软件编程 > Python代码 >

对python3.4 字符串转16进制的实例详解

时间:2022-01-12 08:51:34 | 栏目:Python代码 | 点击:

如下所示:

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)

您可能感兴趣的文章:

相关文章