Python problem

John Parker parkjv1 at gmail.com
Mon Mar 28 18:58:04 EDT 2011


Ethan,

Thanks for pointing that out.  I commented that code out and then ran it.

It created the list of names.  Now, I just need to figure out how to get the
scores into the list called scores.

It would appear that this is done with a nested for loop.

Thanks,

John



On 3/28/11 12:02 PM, "Ethan Furman" <ethan at stoneleaf.us> wrote:

> 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