当前位置:主页 > 软件编程 > Python代码 >
时间: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)