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编码
原文地址:https://www.cnblogs.com/apple2016/p/9993825.html
时间: 2024-10-02 23:58:49