Creating a new dictionary in Python

后端 未结 7 2008
难免孤独
难免孤独 2020-11-29 15:17

I want to build a dictionary in Python. However, all the examples that I see are instantiating a dictionary from a list, etc . ..

How do I create a new empty diction

7条回答
  •  春和景丽
    2020-11-29 15:40

    So there 2 ways to create a dict :

    1. my_dict = dict()

    2. my_dict = {}

    But out of these two options {} is efficient than dict() plus its readable. CHECK HERE

提交回复
热议问题