infile = open("D:/test.txt", "r")  #打开文件
outfile = open("D:/pp2.txt", "w") # 内容输出
for line in infile:  #按行读文件,可避免文件过大,内存消耗        
      outfile.write(line.replace('    ', '    '))#first is old ,second is new
infile.close()    #文件关闭
outfile.close()

 

相关文章:

  • 2021-11-27
  • 2022-01-11
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2021-05-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2023-02-08
相关资源
相似解决方案