Python,文件修改

__author__ = '12711'
#-*- coding:utf-8 -*-
f=open("F",'r')
f_n=open("N",'w')
for i in f:
if "我爱你" in i :
i=i.replace("我爱你","我恨你")
f_n.write(i)
f.close()
f_n.close()

posted @ 2018-09-21 19:13  知冬  阅读(81)  评论(0编辑  收藏  举报