I am trying to print a table from a file with fixed columns. I have the initial part down but I am not sure where to begin to break down the data into tables and columns?
raw data in the file is this
William,180, 1st place, 250, 390, 400
tim,182, 2nd place, 160, 380, 400
billy,187, 3rd place, 175, 325, 250
tom,185, 4th place, 150, 300, 200
raw data in the file is this
William,180, 1st place, 250, 390, 400
tim,182, 2nd place, 160, 380, 400
billy,187, 3rd place, 175, 325, 250
tom,185, 4th place, 150, 300, 200
#column are name, wt, place, deadlift, squat, benchpress rfile = open("finishers.txt", "r") file = rfile.readlines() for line in file: values = line.split(',') print (values) rfile.close()
Output: desired out put
Name WT Place Deadlift Squat Benchpress
William 180 1st place 250 390 400
tim 182 2nd place 160 380 400
billy 187 3rd place 175 325 250
tom 185 4th place 150 300 200