python 检测字符串编码类型是什么

        for index,value in enumerate(listvalue):
            adchar=chardet.detect(value)
            print adchar
            if adchar['encoding']=='utf-8' or adchar['encoding']=='ascii':
                code='utf-8'
            else:
                code='GBK'
            value=value.decode(code)#解码生成unicode编码

  

猜你喜欢

转载自www.cnblogs.com/apple2016/p/9993825.html