import codecs
import chardet
encoding = chardet.detect(open(inpath, 'rb').readline()).get('encoding')
with codecs.open(inpath, encoding=encoding, errors='ignore') as fr:
str = unicode(str, errors='ignore')
import codecs
import chardet
encoding = chardet.detect(open(inpath, 'rb').readline()).get('encoding')
with codecs.open(inpath, encoding=encoding, errors='ignore') as fr:
str = unicode(str, errors='ignore')
本文标题:字符串编码解码
本文链接:https://www.haomeiwen.com/subject/ldotwftx.html
网友评论