创建中文文件时,乱码
解决办法:
1.创建文件夹先decode(‘utf-8’)再encode(‘gbk’)
2.读取文件夹 .decode(‘gbk’).encode(‘utf-8’)
# -*- coding: utf-8 -*-
import os
path = 'd:/assist1/测试'.decode('utf-8').encode('gbk')
isExists=os.path.exists(path)
if not isExists:
os.makedirs(path)
os.chdir(path)
读取文件
for root,dirs,files in os.walk("f:\\"):
for dir in