📜  使用 readline() 函数逐行读取文本文件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:18.228000             🧑  作者: Mango

代码示例1
# Program to read all the lines in a file using readline() function
file = open("python.txt", "r")
while True:
    content=file.readline()
    if not content:
        break
    print(content)
file.close()