Python 初学者词典
一个关于词典的简短问题。下面的字典有两个嵌套列表,对吗?里面有很多新字典?像一份字典清单?还是我看错了?我知道这是一个简单的答案,但我想在继续之前确保我理解了Python 初学者词典,python,Python,一个关于词典的简短问题。下面的字典有两个嵌套列表,对吗?里面有很多新字典?像一份字典清单?还是我看错了?我知道这是一个简单的答案,但我想在继续之前确保我理解了 users = { 'Students': [ {'first_name': 'Michael', 'last_name' : 'Jordan'}, {'first_name' : 'John', 'last_name' : 'Rosales'}, {'first_name' : 'Mark', 'last_na
users = {
'Students': [
{'first_name': 'Michael', 'last_name' : 'Jordan'},
{'first_name' : 'John', 'last_name' : 'Rosales'},
{'first_name' : 'Mark', 'last_name' : 'Guillen'},
{'first_name' : 'KB', 'last_name' : 'Tonel'}
],
'Instructors': [
{'first_name' : 'Michael', 'last_name' : 'Choi'},
{'first_name' : 'Martin', 'last_name' : 'Puryear'}
]
}
用户是一个
字典
,它具有字符串
键
和字典
的列表
作为值
。例如:
第一个键是Students
,其值为:
[
{'first_name': 'Michael', 'last_name' : 'Jordan'},
{'first_name' : 'John', 'last_name' : 'Rosales'},
{'first_name' : 'Mark', 'last_name' : 'Guillen'},
{'first_name' : 'KB', 'last_name' : 'Tonel'}
]
使用{}而不是[]@Aditya_kr我不想改变它,我想了解它是什么。它的崩溃。它是为课堂上的作业编写的,只是想在继续之前掌握它。好吧,用户就是字典,有两个键“students”和“instructors”,每个键都有一个值列表。我理解你的意思对吗?每个键都有一个值,这是
字典的列表
,我现在明白了!