我不确定如何最好地描述它,但是如果我有一个字典,它在实际键值之前有文本或名称,我如何从字典中提取它以得到实际的键值对?
{'students':[
{'username': 'Mike1@example.com', 'enabledUser': true, 'password': null, 'identifier': '996_STU_10100001', 'dateLastModified': '2018-08-01T17:13:40.003Z', 'middleName': 'Sierra', 'userIds': null, 'familyName': 'Aadgoo', 'sms': null, 'phone': '8888880001', 'grades': ['01'], 'sourcedId': 'STU_10100001', 'role': 'student', 'status': 'active', 'orgs': [{'href': '~/ims/oneroster/v1p1/orgs/996', 'type': 'org', 'sourcedId': '996'}], 'agents': [], 'givenName': 'Mike', 'email': 'Mike1@example.com', 'metadata': null}
{'username': 'Jonathan2@example.com', 'enabledUser': true, 'password': null, 'identifier': '996_STU_10100002', 'dateLastModified': '2018-08-01T17:13:40.003Z', 'middleName': 'Alpha', 'userIds': null, 'familyName': 'Bravo', 'sms': null, 'phone': '8888880002', 'grades': ['05'], 'sourcedId': 'STU_10100002', 'role': 'student', 'status': 'active', 'orgs': [{'href': '~/ims/oneroster/v1p1/orgs/996', 'type': 'org', 'sourcedId': '996'}], 'agents': [], 'givenName': 'Jonathan', 'email': 'Johnathan2@example.com', 'metadata': null}...]}
要从中提取的所需键值:
'username': 'Mike1@example.com', 'enabledUser': true, 'password': null, 'identifier': '996_STU_10100001', 'dateLastModified': '2018-08-01T17:13:40.003Z', 'middleName': 'Sierra', 'userIds': null, 'familyName': 'Aadgoo', 'sms': null, 'phone': '8888880001', 'grades': ['01'], 'sourcedId': 'STU_10100001', 'role': 'student', 'status': 'active', 'orgs': [{'href': '~/ims/oneroster/v1p1/orgs/996', 'type': 'org', 'sourcedId': '996'}], 'agents': [], 'givenName': 'Mike', 'email': 'Mike1@example.com', 'metadata': null
'username': 'Jonathan2@example.com', 'enabledUser': true, 'password': null, 'identifier': '996_STU_10100002', 'dateLastModified': '2018-08-01T17:13:40.003Z', 'middleName': 'Alpha', 'userIds': null, 'familyName': 'Bravo', 'sms': null, 'phone': '8888880002', 'grades': ['05'], 'sourcedId': 'STU_10100002', 'role': 'student', 'status': 'active', 'orgs': [{'href': '~/ims/oneroster/v1p1/orgs/996', 'type': 'org', 'sourcedId': '996'}], 'agents': [], 'givenName': 'Jonathan', 'email': 'Johnathan2@example.com', 'metadata': null