f.write(rf.replace(' ',''))

f.write(rf.replace('1041','\n1041'))

 

不能连续起作用?

# -*- coding: UTF-8 -*-
import os
f= open('E:\\Python\\Code\\line0408b.txt', 'r')

#读取文件
rf=f.read()
#rf=f.read().decode('UTF-8')


#去掉空格
#插入换行符
f= open('E:\\Python\\Code\\after.txt', 'w')
f.write(rf.replace(' ',''))

f.write(rf.replace('1041','\n1041'))
f.close()

相关文章:

  • 2021-07-03
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2021-04-29
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2021-12-23
  • 2021-12-29
  • 2022-02-16
  • 2022-12-23
相关资源
相似解决方案