#------------------------------------------------------------------------------ # File1.py #------------------------------------------------------------------------------ # main() ---------------------------------------------------------------------- def main(): f = open('Matrix.py', 'r') while True: line = f.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) # Process the line we've just read. # Notice that a extra blank line is printed, # since line already has '\n' in it. # If you don't want that extra newline, then # do line = line.strip() to get rid of it, # or do print(line, end='') to supress the # one that print() automatically sends to # output. # print(line, end='') # print(line[:-1]) # end while f.close() print() # end main() ------------------------------------------------------------------ # ----------------------------------------------------------------------------- if __name__=='__main__': main() # end if ----------------------------------------------------------------------