【Python】bytes和hex字符串之间的相互转换

十六进制字符串:a="CC DD 01 61 F6 01 00 64 A4 81 00 00 00 8B"

b=bytes.fromhex(a) 转为字节

from socket import *

 b=bytes.fromhex(a)

udpSocket=socket(AF_INET,SOCK_DGRAM)

udpSocket.sendto(b,("192.168.3.22",8280))

原文地址:https://www.cnblogs.com/susie-701/p/12090477.html