How to add multiple values to a dictionary key in python?

I want to add multiple values to a specific key in a python dictionary. How can I do that?

a = {}
a["abc"] = 1
a["abc"] = 2

This will replace the value of a[“abc”] from 1 to 2.

What I want instead is for a[“abc”] to have multiple values(both 1 and 2).

Leave a Comment