__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()