标签:nbsp alter pen python with pat coding ace env
#!/usr/bin/env python # -*- coding: UTF-8 -*- def alter(file,old_str,new_str): file_data = "" with open(file, "r", ) as f: for line in f: if old_str in line: line = line.replace(old_str,new_str) file_data += line with open(file,"w",) as f: f.write(file_data) alter("@option.file_path@", "@option.old_file@", "@option.new_file@")
标签:nbsp alter pen python with pat coding ace env
原文地址:https://www.cnblogs.com/niwajiang1/p/9419048.html