有一串十六进制数据,是Uncode字符。
import struct strhex='003100310031' buf = strhex.decode("hex") value=u'' slen=len(buf)/2 si=0 while si<slen: tmp=buf[si*2:si*2+2] sh=struct.unpack('>H',tmp)[0] value=value+unichr(sh) si=si+1 print value
标签:字符,十六进制,Python,value,si,Unicode,2.7 From: https://www.cnblogs.com/SamFang/p/17012155.html