Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29850
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2012-09-23 11:55 -0700 |
| References | <ec85c16b-086b-4b43-aba3-70a05f34cf69@googlegroups.com> <mailman.1147.1348426062.27098.python-list@python.org> |
| Subject | Re: 'str' object does not support item assignment |
| From | jimbo1qaz <jimmyli1528@gmail.com> |
| Message-ID | <mailman.1149.1348426512.27098.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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