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


Groups > comp.lang.python > #29850

Re: 'str' object does not support item assignment

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jimmyli1528@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; 'string.': 0.04; 'mrab': 0.05; 'nested': 0.07; "subject:' ": 0.07; 'though:': 0.07; 'array.': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python- list': 0.10; 'subject:not': 0.11; 'subject:item': 0.16; 'subject:object': 0.16; 'string': 0.17; '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; 'accidentally': 0.29; "i'm": 0.29; 'error': 0.30; 'another': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'list.': 0.35; 'created': 0.36; 'should': 0.36; 'does': 0.37; 'item': 0.37; 'received:209': 0.37; 'object': 0.38; 'instead': 0.39; 'is.': 0.62; 'idiot.': 0.84; 'received:209.85.220.184': 0.91
Newsgroups comp.lang.python
Date Sun, 23 Sep 2012 11:55:09 -0700 (PDT)
In-Reply-To <mailman.1147.1348426062.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=2602:306:cd9e:2850:5120:f6ff:b92b:1e08; posting-account=An6yGQoAAAD9ay8V5T7Wu52YyqyK-bYm
References <ec85c16b-086b-4b43-aba3-70a05f34cf69@googlegroups.com> <mailman.1147.1348426062.27098.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 2602:306:cd9e:2850:5120:f6ff:b92b:1e08
MIME-Version 1.0
Subject Re: 'str' object does not support item assignment
From jimbo1qaz <jimmyli1528@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
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>
Message-ID <mailman.1149.1348426512.27098.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348426512 news.xs4all.nl 6933 [2001:888:2000:d::a6]:46726
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29850

Show key headers only | View raw


On Sunday, September 23, 2012 11:48:11 AM UTC-7, MRAB wrote:
> On 2012-09-23 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.
> 
> >
> 
> The error suggests that spots[y] is actually a string. Printing
> 
> repr(spots) and repr(spots[y]) should tell you whether it is.

ya, I'm an idiot. I accidentally made a string instead of an array.

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