readline()
with open("readlines.txt") as f:
line = f.readline()
while line:
print(line)
line = f.readline()
readlines()
with open("readlines.txt","r") as f:
lines = f.readlines()
for line in lines:
print(line)
文件迭代器
with open("readlines.txt") as f:
for line in f:
print(line)
fileinput
import fileinput
for line in fileinput.input("readlines.txt"):
print(line)