uao_decode.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:imaple-crawler 作者: leVirve 项目源码 文件源码
def decode(self, input, errors='strict'):
        unistr = u''
        ptr = 0

        input_len = len(input)

        while input_len > ptr:
            try:
                hex = input[ptr:ptr+2]
                mapkey = struct.unpack('!H', hex)[0]
                uni = unichr(decoding_map[mapkey])
                unistr += uni
                ptr += 2
            except:
                hex = input[ptr]
                val = struct.unpack('!B', hex)[0] if six.PY2 else hex
                uni = unichr(val)
                unistr += uni
                ptr += 1

        return unistr, len(unistr)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号