dictionary object

Nathan Clegg nathan at islanddata.com
Tue May 11 14:14:24 EDT 1999


> Ooops, you are right, I have simplified too much the program I'm
> writing, sorry!
> 
> The problem is that the element of the tuple that I must change, must
> be changed based on the other element of the tuple.
> 
>   num = dict["pluto"][0]
>   dict["pluto"]= (num, "hello " + num)

This could still be solved using lists instead of tuples:

l = dict["pluto"]
l[1] = "hello" + l[0]

or, more likely:

l = dict["pluto"]
l[1] = "hello %d" % l[0]



----------------------------------
Nathan Clegg
 nathan at islanddata.com






More information about the Python-list mailing list