按行读取文本,当读取到的那一行为空时,跳出循环

file =  open("readme")


while True:
    text = file.readline()

    if not text:
        break

    print(text,end="")

file.close()

python文件操作

相关文章:

  • 2021-04-06
  • 2021-06-05
  • 2022-01-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-12-12
  • 2021-12-12
  • 2022-01-07
  • 2021-10-23
相关资源
相似解决方案