codegay 当前离线
少校
#2016年9月30日 22:48:33 codegay import re rec = re.compile("\s*点击下载\s*",re.DOTALL) with open("a.txt","r+") as f: txt = f.read() print("原文:\n", txt) txt = rec.sub("\n",txt) print("新:\n", txt) f.seek(0) f.truncate(0) f.write(txt) #覆盖原文件复制代码
TOP