Python 字典
字典
字典是一种无序、可变且有索引的集合。在 Python 中,字典使用大括号编写,并且包含键和值。
实例
创建并打印字典:
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(thisdict)
字典是一种无序、可变且有索引的集合。在 Python 中,字典使用大括号编写,并且包含键和值。
创建并打印字典:
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(thisdict)