On Mon, 28 Mar 2011 11:38:29 -1000, John Parker <park...@gmail.com> wrote: [snip] > 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' > > So, what am I doing wrong? infile.readlines returns a list of strings, each string being one line of the input file. Being a list, it doesn't have a "split" attribute. Strings have a "split" attribute. Did you intend to split just one of the input strings? -- http://mail.python.org/mailman/listinfo/python-list