1 import sys
 2 
 3 f=open('lyrics.txt','r',encoding='utf-8')  #读写
 4 f_new=open('lyrics_new','w+',encoding='utf-8')
 5 find_str=sys.argv[1]
 6 replace_str=sys.argv[2]
 7 for line in f:
 8     if find_str in line:
 9         line=line.replace(find_str,replace_str)
10     f_new.write(line)
11 f.close()
12 f_new.close()

 

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2021-10-03
  • 2021-09-27
  • 2021-11-12
  • 2022-12-23
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2022-01-07
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
  • 2022-12-23
相关资源
相似解决方案