网络数据解析

字节转化为16进制

import codecs
data = socket.recv(1024)
tmp = codecs.encode(data, "hex")

struct:

https://docs.python.org/3.6/library/struct.html?highlight=struct#module-struct

This module performs conversions between Python values and C structs represented as Python bytes objects. 

 

posted @ 2019-05-30 14:12  逐梦客!  阅读(140)  评论(0)    收藏  举报