Newbie help with array handling

7stud bbxx789_05ss at yahoo.com
Thu Apr 12 11:50:55 CEST 2007


On Apr 12, 3:31 am, "loial" <a... at loial.co.uk> wrote:
> OK, thanks for the replies
>
> One other thing...I need to update the values since they are basically
> totals that I am accumulating.
>
> How do I update a specific value for a specific key?

mydict["keyvalue1"]

returns the value, which in this case is a list.  So, you could write:

lst = mydict["keyvalue1"]
lst[0] = 4
list.append("red")

or you can do it directly:

mydict["keyvalue1"][0] = 4
mydict["keyvalue1"].append("red")




More information about the Python-list mailing list