String object has no attribute "append"

Chris Angelico rosuav at gmail.com
Wed May 29 03:54:38 EDT 2013


On Wed, May 29, 2013 at 4:25 AM, Matt Graves <tunacubes at gmail.com> wrote:
> I receive this error while toying around with Functions...
>
> def pulldata(speclist,speccolumn):
>                  (speclist).append(column[('speccolumn')])
>
> pulldata(speclist = 'numbers', speccolumn = "0")
>
> I'm getting the error because it should say "numbers.append", but it is reading it as "(speclist).append".

Others have answered the immediate problem, but you may find this a
worthwhile read:

http://mail.python.org/pipermail/tutor/2010-December/080505.html

It's an excellent explanation of the way Python passes arguments to functions.

ChrisA



More information about the Python-list mailing list