"""使用{}创建字典"""
scores = {'张三': 100, '王五': 80, '李四': 78}
print(scores)
print(type(scores))
"""使用内置函数dict()创建"""
student = dict(name='jack', age=20)
print(student)
print(type(student))
"""空字典"""
d = {}
print(d)
Python:字典的创建
最新推荐文章于 2024-04-23 15:10:05 发布