I have simple dictionary with key, value:
d = {\'word\': 1, \'word1\': 2}
I need to add another value (to make a list from values):
Well you can simply use:
d['word'] = [1,'something']
Or in case the 1
needs to be fetched:
d['word'] = [d['word'],'something']
Finally say you want to update a sequence of keys with new values, like:
to_add = {'word': 'something', 'word1': 'something1'}
you could use:
for key,val in to_add.items():
if key in d:
d[key] = [d[key],val]