path = "D:/tempData/sougou" #文件夹目录
files= os.listdir(path) #得到文件夹下的所有文件名称
new_line=[]
for file in files: #遍历文件夹
if not os.path.isdir(file): #判断是否是文件夹,不是文件夹才打开
f1= codecs.open(path+"/"+file,'rb').read()
f=f1.decode('gb2312','ignore')
解决python 读中文文件时编码不正确的问题
最新推荐文章于 2022-05-11 23:13:58 发布