[Tutor] appending/updating values dict key value pairs
Sivaram Neelakantan
nsivaram.net at gmail.com
Sat Jun 22 18:56:40 CEST 2013
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
--
More information about the Tutor
mailing list