0

How can I add a value in a list for a key in a dictionary??

For example dicc={colors:[blue]} --> dicc={colors: [blue, red]}

24th Jan 2017, 6:19 PM
MIGUEL GARCÍA GÓMEZ
MIGUEL GARCÍA GÓMEZ - avatar
3 Respostas
0
Looking for something like this? >>> x = {1:2} >>> print x {1: 2} >>> x.update({3:4}) >>> print x {1: 2, 3: 4} See https://www.tutorialspoint.com/JUMP_LINK__&&__python__&&__JUMP_LINK/dictionary_update.htm
24th Jan 2017, 6:38 PM
Alex
Alex - avatar
0
Thanks
24th Jan 2017, 6:51 PM
MIGUEL GARCÍA GÓMEZ
MIGUEL GARCÍA GÓMEZ - avatar
- 2
dict_name[key].append(value) Something wrong? It is right answer
24th Jan 2017, 6:35 PM
Leshark
Leshark - avatar