Python problem

Ethan Furman ethan at stoneleaf.us
Mon Mar 28 18:02:25 EDT 2011


John Parker wrote:
> I have written the following code so far but get an error.
> 
> infile = open("scores.txt", "r")
> lines = infile.readlines()
> infile.close()
> tokens = lines.split(",")

[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'

Check out the line just above my snip.

Did you mean for that line to be there?  It's /almost/ the same line you 
have down in the for loop.

~Ethan~



More information about the Python-list mailing list