code: def modify_content(file, old, new):
      
      try:
          lines = open(file, 'r').readlines()
          f_len = len(lines) - 1
          for i in range(f_len):
              if old in lines[i]:
                  lines[i] = lines[i].replace(old, new)
          open(file, 'w').writelines(lines)
      except Exception as e:
          print(e)
docs: 替换文件中的指定内容，逐行进行