目标文件夹: 文件内容: 实现代码: # -*- coding:utf-8 -*- # __author__ :kusy # __content__:get ssr info from html files # __date__:2018/10/29 14:43 import os import re def getssr(): srcdir = os.path.abspath('src') files = os.listdir(srcdir) filestr = '' for file in
Python批量替换文件内容,支持嵌套文件夹 import os path="./" for root,dirs,files in os.walk(path): for name in files: #print name if name.endswith(".html"): #print root,dirs,name filename=root+"/"+name f=open(filename,"r") fileconten