方法1:
with open('1.txt', 'r') as fp: for line in fp: print(line)
方法2:
with open('1.txt', 'r') as fp: text = fp.readline() while text!='': print(text) text = fp.readline()