标签:content put day close lease pen 修改 替换 please
在原有的文件上,修改替换,并放到新的文件里
old = open(‘day‘,‘r‘)
new = open(‘new_day‘,‘w‘)
old_replace = input(‘please replace content:‘)
new_replace = input(‘please new replace content:‘)
for i in old:
if old_replace in i:
i = i.replace(old_replace,new_replace)
new.write(i)
old.close()
new.close()
标签:content put day close lease pen 修改 替换 please
原文地址:http://blog.51cto.com/10181121/2061807