f = open("DDD_sales.txt", 'r', True)
filepath="data1.txt"
f1 = open(filepath, mode="a", encoding="utf-8")
line=""
ix=0
while True:
  # 每次读取一个字符
  ch = f.read(1)
  # 如果没有读到数据,跳出循环
  if not ch: break
  line= line+str(ch)
  if(ch==";"):
      ix=ix+1
      f1.write(str(line[0:len(line) - 1])+ "\n")
      f1.flush()
      print(str(ix))
      line=""
f1.close()
f.close()

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2021-12-03
  • 2022-12-23
  • 2021-04-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案