If you want to create a dictionary where you map keys to more than one value (a “multi-dict”), you must store these values into another container like a list or set. Use lists if you want to preserve the order of insertions, use sets if you don’t want to keep duplicates. It all depends on your use case, use the container with the characteristics that fit your needs.

d = {
  "a" : [1, 2, 3],
  "b" : [4, 5]
}

d
## {'a': [1, 2, 3], 'b': [4, 5]}
e = {
  "a" : {1, 2, 3},
  "b" : {4, 5}
}

e
## {'a': {1, 2, 3}, 'b': {4, 5}}

You can also use defaultdict which allows you to write cleaner code.

from collections import defaultdict

d = defaultdict(list)
d["a"].append(1)
d["a"].append(2)
d["a"].append(3)
d["b"].append(4)
d["b"].append(5)

d
## defaultdict(<class 'list'>, {'a': [1, 2, 3], 'b': [4, 5]})
e = defaultdict(set)
e["a"].add(1)
e["a"].add(2)
e["a"].add(3)
e["b"].add(4)
e["b"].add(5)

e
## defaultdict(<class 'set'>, {'a': {1, 2, 3}, 'b': {4, 5}})