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


Groups > comp.lang.python > #29848

Re: 'str' object does not support item assignment

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
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; 'reason,': 0.07; "subject:' ": 0.07; 'though:': 0.07; 'python': 0.09; '"a"': 0.09; 'cc:addr:python-list': 0.10; 'subject:not': 0.11; "'c'": 0.16; 'subject:item': 0.16; 'subject:object': 0.16; 'wrote:': 0.17; 'subject:support': 0.22; 'cc:2**0': 0.23; 'work.': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '>>>>': 0.29; 'another': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'list.': 0.35; 'created': 0.36; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'does': 0.37; 'item': 0.37; 'received:209': 0.37; 'object': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=WufZaJp6guvmrOFZo4ey6t8Cps/5n5rm5vrgEi9NMyo=; b=ys6bUW7SV2PLibByIZwBM2ZRS0/aBdw6EKua36iQ3HfKN0xDegpIthU3mR2RSSfVHR jleaqlZ4hD0gQU0ZSAR1g68X00+ZsaeeLA5HcECG2p2pm0iTxSvorn5YqhhQpPoBYBKV TQQNqRtSNyo9mOguRau1ZOPyowkas1AhrBjvwUN2gdwogU0RAq+EtA/sH1fRjzB8JHwB +ij/XodQermxz9mTsGoS14v94+nDjyYR4LluhzamuKV0BAELTC49A/K4tIGJxMLOpODh zyTwb9T7rVTlGfOBsI9p6Y/PSbr4XO19eAjypHMEiDPZOPGruA76k3hIN6ztROODCHVN haOw==
Date Sun, 23 Sep 2012 19:48:49 +0100
From Andrea Crotti <andrea.crotti.0@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120910 Thunderbird/15.0.1
MIME-Version 1.0
To jimbo1qaz <jimmyli1528@gmail.com>
Subject Re: 'str' object does not support item assignment
References <ec85c16b-086b-4b43-aba3-70a05f34cf69@googlegroups.com>
In-Reply-To <ec85c16b-086b-4b43-aba3-70a05f34cf69@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc python-list@python.org
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.1148.1348426187.27098.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348426187 news.xs4all.nl 6886 [2001:888:2000:d::a6]:41275
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29848

Show key headers only | View raw


On 09/23/2012 07:31 PM, 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.

But
a = "a"
a[0] = 'c'
fails for the same reason, which is that strings in Python are immutable..

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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