On Mon, 28 Mar 2011 22:38:29 +0100, John Parker <park...@gmail.com> wrote:

infile = open("scores.txt", "r")
lines = infile.readlines()
infile.close()
tokens = lines.split(",")
names = []
scores = []

[snippety snip]

error:
Traceback (most recent call last):
  File "Score_8.py", line 38, in <module>
    tokens = lines.split(",")
AttributeError: 'list' object has no attribute 'split'

So, what am I doing wrong?

Exactly what the traceback says: you're taking `lines`, the list you created of all the lines in the file, and trying to split the list *as a whole* on commas. That doesn't work. You split strings, not lists. By the looks of it that line is something left over from a previous attempt. Just delete it, it's not doing anything useful for you.

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to