卖逼视频免费看片|狼人就干网中文字慕|成人av影院导航|人妻少妇精品无码专区二区妖婧|亚洲丝袜视频玖玖|一区二区免费中文|日本高清无码一区|国产91无码小说|国产黄片子视频91sese日韩|免费高清无码成人网站入口

python中g(shù)bk轉(zhuǎn)utf8 python怎么把ASNI(GB2312)轉(zhuǎn)換成UTF-8?

python怎么把ASNI(GB2312)轉(zhuǎn)換成UTF-8?#!/usr/bin/env python3from chardet import detectfn=“a.txt”with open(fn

python怎么把ASNI(GB2312)轉(zhuǎn)換成UTF-8?

#!/usr/bin/env python3from chardet import detectfn=“a.txt”with open(fn,“rb”)as f:s=f.read()coding=detect(s)[“encoding”]print(“coding:{}”).format(coding))print(“content:{}”.format(s.decode(coding).rstrip()))newf=“b.txt”with open(newf,“wb”)as f:f.write(s.decode(coding).encode(“utf8”)print(“done!”!將編碼轉(zhuǎn)換為UTF-8并將內(nèi)容連接到{}'。Format(newf))

如果您報告importerror,那么

PIP install chardet

您可以在理解代碼后集成def