如下所示:
1
2
3
4
5
6
|
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)
|
以上这篇对python3.4 字符串转16进制的实例详解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/chi5048/article/details/78464164