Wait!!!
To make the program pause at each five lines we will have to count the lines. The i variable in line 4 will hold the counter.
1:cars_file = open('2006_FE_Guide_14-Nov-2005_download.csv', 'rb') 2: 3:# i will be our line counter so we know when to pause 4:i = 0 5: 6:print 7: 8:for line in cars_file: 9: 10: i = i + 1 # increment i by 1 at each line 11: 12: print line 13: 14: if i == 5: # change 5 to whatever you think is adequate 15: 16: i = 0 # zero the counter 17: print 18: raw_input("Hit Enter to continue: ") # wait for the user 19: print 20: 21:print 22:cars_file.close() 23:
At each line read from file the counter is incremented by 1 (line 10) and when it gets to 5 it is reset to 0 (line 16), so it can count to 5 again, and the program asks for user input.
The list is too long and if you want to stop hit Ctrl-C
The values in each line are intentionally separated by commas (.csv file) to make it easy for a programmer to catch each value. We will do it next.