if key exist add value to list python 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')