I want to add an item to an existing dictionary in Python. For example, this is my dictionary:

default_data = {
            'item1': 1,
            'item2': 2,
}

I want to add a new item such that:

default_data = default_data + {'item3':3}

How can I achieve this?

3 s
3

Leave a Reply

Your email address will not be published. Required fields are marked *