Page 210 -
P. 210
additional data
Coach Kelly is back
(with a new file format)
I love what you’ve done, but I can’t tell which line
of data belongs to which athlete, so I’ve added some
information to my data files to make it easy for you to
figure it out. I hope this doesn’t mess things up much.
The output from your last program in Chapter 5 was exactly what the coach
was looking for, but for the fact that no one can tell which athlete belongs to
which data. Coach Kelly thinks he has the solution: he’s added identification This is “sarah2.txt”, with
data to each of his data files: extra data added.
Sarah Sweeney,2002-6-17,2:58,2.58,2:39,2-25,2-55,2:54,2.18,2:55,2:55,2:22,2-21,2.22
Sarah’s timing data
Sarah’s full name Sarah’s date of birth
Do this!
If you use the split() BIF to extract Sarah’s data into a list, the first data
item is Sarah’s name, the second is her date of birth, and the rest is Sarah’s
timing data.
Let’s exploit this format and see how well things work. Grab the updated files from the
Head First Python website.
174 Chapter 6