Python字典的定义
钱满满 •
定义一个新字典:
1、使用花括号定义:
{'one':1, 'two':2}
2、使用类型构造器:
dict(one=1, two=2)
3、使用字典推导式:
{x:x**2 for x in range(10)}