# Author: James Tam # Version: March 23 2010 # Reads a line at a time from an arbitrary sized file called "input2.txt" # into a 2D list. # Open file for reading, confirm file with user. inputFile = open ("input2.txt", "r") # While we haven't read past the end of the file continue reading from # it. myList = [] for line in inputFile: # Add the string read in from file as a new row in the list. myList.append(line) # Finished writing to file, provide feedback to user and close file. inputFile.close() # Show the contents of the list, each line is preceeded by the row number. row = 0 for line in myList: if (row < 10): print row, line, else: temp = row + 55 ch = chr(temp) print ch, line, row = row + 1