python文件内容修改

# Author:Sooele
import sys
 f = open("yesterday2.py","r",encoding="utf-8") #打开文件。权限读
 f_new = open("yesterday3","w",encoding="utf-8")#打开文件。权限写 
 find_str = sys.argv[1] #找到
 replace_str = sys.argv[2] #替换
 for line in f: #如果line在f里。就执行下面
 if find_str in line:#
 line = line.replace(find_str,replace_str)#替换
 f_new.write(line)
 f.close() #关闭f
 f_new.close() #关闭发f_new