python学习

文件遍历

root,subdir,file = os.walk()

subdir[:]=[]  不遍历子目录

文件读取

path+getcwd()

open(file,'r',encode='utf-8')

文件写入

open(file,'w',encode='utf-8')

原文地址:https://www.cnblogs.com/mathprice/p/9156409.html