Having trouble getting this started. I wan't to read lines of data from my file, which has the current contents
Names Difficulty Scores Totals Mark Smith 2.5 6.0 5.0 5.5 5.5 6.5 6.0 6.5 44.25 John Andrews 2.8 5.5 5.5 6.0 4.5 6.0 5.5 5.0 46.20
and using this code, read the file to extract certain fields for calculation
def main(): fileIn = open( "scores.txt", "r") lineIn = fileIn.readline() while len(lineIn) != 0: print lineIn lineIn = fileIn.readline() main()
What would be a simple way to extract a field like 6.0 from scores to be used in my final calculation?
Should I define each field like 'scores' ' names' ' difficulty' in the code itself? or read from the whole file?
Any help would be appreciated