On 22/06/2013 17:56, Sivaram Neelakantan wrote:

What's the best way to append to the list which is the value to a dict
key?

I did the following based on the docs and I'm not sure why it works

b = { 'a': [4, 5]}
list.append(b.get('a'),'c')
b
{'a': [4, 5, 'c']}



as in, shouldn't it be

b['a'] = list.append(b.get('a'),'c')

which doesn't seem to work.

  sivaram
  --

b['a'].append('c')

--
"Steve is going for the pink ball - and for those of you who are watching in black and white, the pink is next to the green." Snooker commentator 'Whispering' Ted Lowe.

Mark Lawrence

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to