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: 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: 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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: 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 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.