python if key in dictionary exist then add another value code example
Example: python dictionary append value if key exists
from collections import defaultdict
d = defaultdict(list)
d['key'].append('mykey')
from collections import defaultdict
d = defaultdict(list)
d['key'].append('mykey')