Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46323
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-05-28 11:25 -0700 |
| Message-ID | <8d8143e8-74f3-43a0-9a52-06b60e857984@googlegroups.com> (permalink) |
| Subject | String object has no attribute "append" |
| From | Matt Graves <tunacubes@gmail.com> |
I receive this error while toying around with Functions...
def pulldata(speclist,speccolumn):
with open('profiles.csv', 'r') as f:
reader = csv.reader(f)
for column in reader:
(speclist).append(column[('speccolumn')])
pulldata(speclist = 'numbers', speccolumn = "0")
>Traceback (most recent call last):
> File "C:\Desktop\Python\CFI\Devices V2\users.py", line 17, in <module>
> pulldata(speclist = 'numbers', speccolumn = "0")
> File "C:\Desktop\Python\CFI\Devices V2\users.py", line 16, in pulldata
> (speclist).append(column[('speccolumn')])
>AttributeError: 'str' object has no attribute 'append'
I'm getting the error because it should say "numbers.append", but it is reading it as "(speclist).append".
This is my first time playing with functions, so be gentle.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
String object has no attribute "append" Matt Graves <tunacubes@gmail.com> - 2013-05-28 11:25 -0700 Re: String object has no attribute "append" "marduk@python.net" <marduk@python.net> - 2013-05-28 14:40 -0400 Re: String object has no attribute "append" Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-28 12:41 -0600 Re: String object has no attribute "append" Ian Kelly <ian.g.kelly@gmail.com> - 2013-05-28 12:43 -0600 Re: String object has no attribute "append" Chris Angelico <rosuav@gmail.com> - 2013-05-29 17:54 +1000
csiph-web