源代码下载:下载地址在这里 # 029 aFile = file(r'C:/in.txt', 'r') while True: line = aFile.readline() if len(line) == 0: break # end of if print line, # end of while aFile.close() output: >>> This is the first line. This is the second line. This is the third line. >>>