[email protected] wrote:
> Error comes up saying "IndexError: list index out of range."
OK, then the 12th line starts with a whitespace char. Add more print
statements to see the problem:
> scores = stu_scores()
print scores
> for line in scores:
print repr(line)
> fields = line.split()
> name = fields[0]
> print (fields)
Hint:
> def stu_scores():
> lines = []
> with open("file.txt") as f:
> lines.extend(f.readlines())
> return ("".join(lines[11:]))
Why did you "".join the lines?
--
https://mail.python.org/mailman/listinfo/python-list