Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46324

Re: String object has no attribute "append"

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <marduk@python.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'attribute': 0.07; 'column': 0.07; 'received:internal': 0.09; 'def': 0.12; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:mail.srv.osa': 0.16; 'received:messagingengine.com': 0.16; 'received:nyi.mail.srv.osa': 0.16; 'received:osa': 0.16; 'received:srv.osa': 0.16; 'subject:String': 0.16; 'subject:object': 0.16; 'wrote:': 0.18; 'error': 0.23; 'skip:" 30': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'skip:p 30': 0.29; 'skip:( 40': 0.30; "i'm": 0.30; 'getting': 0.31; 'file': 0.32; 'says': 0.33; '(most': 0.33; 'reader': 0.33; 'received:66': 0.35; 'but': 0.35; 'skip:> 10': 0.36; 'should': 0.36; 'received:10': 0.37; 'skip:o 20': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'subject:"': 0.60; 'header:Message-Id:1': 0.63; 'receive': 0.70; '2013,': 0.91
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=OZeF+WpQpylFtjsgNuuDsDJjj1I=; b=Qn7 szVQTLzUq5ay7VzWbK+cW/ilkokZs8Z9+gTsIbKbjncFPiVzk4pWQWFyv7vccJBu U3IsMYZbZT2784fxYwkrq9cb/tN7+fP9VP0cAERT69tCuVBHqr4xCvSrOYbNrTIh B1fZR7k32BfcTjt4zD8A5qpvWW3MODGtGSkpjOQs=
X-Sasl-Enc B/jj2HY4lP60UadFmkakSlW7iZOjXuAQaam/Of4e32Ev 1369766405
From "marduk@python.net" <marduk@python.net>
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-5ebcfc6a
In-Reply-To <8d8143e8-74f3-43a0-9a52-06b60e857984@googlegroups.com>
References <8d8143e8-74f3-43a0-9a52-06b60e857984@googlegroups.com>
Subject Re: String object has no attribute "append"
Date Tue, 28 May 2013 14:40:05 -0400
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2314.1369766407.3114.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369766407 news.xs4all.nl 15899 [2001:888:2000:d::a6]:40107
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46324

Show key headers only | View raw



On Tue, May 28, 2013, at 02:25 PM, Matt Graves wrote:
> 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".

Because it indeed says "(speclist).append"... am I missing something?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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