#------------------------------------------------------------------------------ # File1.py #------------------------------------------------------------------------------ handle = open('Matrix.py', 'r') while True: # read forever line = handle.readline() # read next line and store as string if len(line) == 0: # if there are no more lines break # leave the loop # end if print(line, end='') # process the line we've just read # notice that we suppress the newline # since line already has one # end while handle.close() print()