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


Groups > comp.lang.python > #29851

Re: 'str' object does not support item assignment

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'nested': 0.07; "subject:' ": 0.07; 'though:': 0.07; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'bug': 0.10; 'subject:not': 0.11; 'options.': 0.15; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'route,': 0.16; 'subject:item': 0.16; 'subject:object': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'code.': 0.20; 'tracker': 0.20; 'subject:support': 0.22; 'work.': 0.23; 'raise': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'looks': 0.26; 'header:X-Complaints-To:1': 0.28; '>>>>': 0.29; 'statements': 0.29; 'code': 0.31; 'from:addr:yahoo.co.uk': 0.32; 'print': 0.32; 'to:addr:python- list': 0.33; 'likely': 0.33; 'another': 0.33; 'list': 0.35; 'there': 0.35; 'list.': 0.35; 'received:org': 0.36; 'created': 0.36; 'does': 0.37; 'option': 0.37; 'item': 0.37; 'data': 0.37; 'mark': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'is.': 0.62; 'forward': 0.66; 'received:2': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: 'str' object does not support item assignment
Date Sun, 23 Sep 2012 20:11:05 +0100
References <ec85c16b-086b-4b43-aba3-70a05f34cf69@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host host-2-97-77-28.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.0; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
In-Reply-To <ec85c16b-086b-4b43-aba3-70a05f34cf69@googlegroups.com>
X-Antivirus avast! (VPS 120923-0, 23/09/2012), Outbound message
X-Antivirus-Status Clean
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.1150.1348427460.27098.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348427460 news.xs4all.nl 6915 [2001:888:2000:d::a6]:56026
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29851

Show key headers only | View raw


On 23/09/2012 19:31, jimbo1qaz wrote:
> spots[y][x]=mark fails with a "'str' object does not support item assignment" error,even though:
>>>> a=[["a"]]
>>>> a[0][0]="b"
> and:
>>>> a=[["a"]]
>>>> a[0][0]=1000000
> both work.
> Spots is a nested list created as a copy of another list.
>

Looks to me as if there are three options.
a) raise a bug report on the Python bug tracker at bugs.python.org.
b) fix your code.

As option b) is the likely route, the way forward is to put print 
statements in your code so you can see what data you have *AND* what 
type it is.

-- 
Cheers.

Mark Lawrence.

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


Thread

'str' object does not support item assignment jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 11:31 -0700
  Re: 'str' object does not support item assignment jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 11:36 -0700
  Re: 'str' object does not support item assignment Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-23 12:45 -0600
  Re: 'str' object does not support item assignment MRAB <python@mrabarnett.plus.com> - 2012-09-23 19:47 +0100
    Re: 'str' object does not support item assignment jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 11:55 -0700
    Re: 'str' object does not support item assignment jimbo1qaz <jimmyli1528@gmail.com> - 2012-09-23 11:55 -0700
  Re: 'str' object does not support item assignment Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-09-23 19:48 +0100
  Re: 'str' object does not support item assignment Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-23 20:11 +0100

csiph-web