'str' object does not support item assignment

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Sep 23 15:11:05 EDT 2012


On 23/09/2012 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.
>

Looks to me as if there are three options.
a) raise a bug report on the Python bug tracker at bugs.python.org.
b) fix your code.

As option b) is the likely route, the way forward is to put print 
statements in your code so you can see what data you have *AND* what 
type it is.

-- 
Cheers.

Mark Lawrence.




More information about the Python-list mailing list