Python problem

Ian Kelly ian.g.kelly at gmail.com
Mon Mar 28 17:51:43 EDT 2011


On Mon, Mar 28, 2011 at 3:38 PM, John Parker <parkjv1 at gmail.com> wrote:
> 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?

'lines' is a list of strings.
'split' is a string method, not a list method, hence the error.

You want to call split on each line individually, not on the list.



More information about the Python-list mailing list