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


Groups > comp.lang.python > #29846

Re: 'str' object does not support item assignment

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'nested': 0.07; "subject:' ": 0.07; 'though:': 0.07; 'sep': 0.09; 'subject:not': 0.11; 'subject:item': 0.16; 'subject:object': 0.16; 'wrote:': 0.17; 'causing': 0.20; 'assignment': 0.22; 'subject:support': 0.22; 'work.': 0.23; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'message-id:@mail.gmail.com': 0.27; 'post': 0.28; '>>>>': 0.29; 'probably': 0.29; 'maybe': 0.29; 'error': 0.30; 'code': 0.31; 'structure': 0.32; 'running': 0.32; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'along': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'list.': 0.35; 'created': 0.36; 'enough': 0.36; 'beyond': 0.37; 'does': 0.37; 'item': 0.37; 'received:209': 0.37; 'object': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'think': 0.40; 'information': 0.63; 'here': 0.65; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=SlpnwCTSqUZkzPDjmCHDhieRBC0oZOTmvdaqNbXeeCE=; b=tfifOjoOZB74suEN1fbvEK0HuheZoNFs31XpQdcl6/yhQFJwQld7FNjuIKc/n44A+R eB8If9A0CJN7SBV2o/XhvH/M486nJmk0WnbaUZGJi7UQMRz4uYX8FLtiNLx+AuHNwNl6 d1OqJfrXM1FwOcd/nJ+G5bzwb6gKd85rnvPoc8aug1bxRsvw6tB+0ojfK3mGQyNoLx3D oDCBWL0Ohi/C1rpOtFJVZjaPapEUqLUuJQGqZBOIXFRKzC9OXwqLPLt3Z9YfRfrg4jcl k0AL24KpD0/B3wBwvQPsKwHRCKl670V4Mv5XItPqkoZDKqLh7IFnDcAHAQi5rrRryxLJ 7lmw==
MIME-Version 1.0
In-Reply-To <ec85c16b-086b-4b43-aba3-70a05f34cf69@googlegroups.com>
References <ec85c16b-086b-4b43-aba3-70a05f34cf69@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sun, 23 Sep 2012 12:45:09 -0600
Subject Re: 'str' object does not support item assignment
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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.1145.1348425941.27098.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348425941 news.xs4all.nl 6863 [2001:888:2000:d::a6]:35900
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29846

Show key headers only | View raw


On Sun, Sep 23, 2012 at 12:31 PM, jimbo1qaz <jimmyli1528@gmail.com> 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.

There's not enough information to go on here to even speculate what
might be causing the error, beyond "spots probably does not have the
structure you think it does".  Please post the code that you're
actually running along with the full error traceback, and then maybe
we can help you out.  Also try printing the value of spots just before
the assignment and see what it actually looks like.

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