我正在尝试更改字典中值的顺序。假设我有一本字典,与名称、班级和班级等级相对应
classGrades={"Computer Science":{"Bob":[98,100,100,88],"Sue":[100,88,100,100],"Jill":[100,100,100,100]},
"English":{"Sue":[100,100,100,100,88],"Mary":[88,90,88,90,88],"John":[100,100,100,100,100],"Joe":[90,90,70,70,80]},"
Chemistry":{"Bob":[98,100,100,88],"Sue":[88,88,88,88],"Jill":[100,100,100,100]}}
目标是改变形式,让每个人的班级都有对应的成绩。预期输出:
{"Bob":{"Computer Science":[98,100,100,88],"Chemistry":[98,100,100,88]},
"Sue":{"Computer Science":[100,88,100,100],"Chemistry":[88,88,88,88],"English":[100,100,100,100,88]},
"Jill":{"Computer Science":[100,100,100,100],"Chemistry":[100,100,100,100]},
"Mary":{"English":[88,90,88,90,88]},
"John":{"English":[100,100,100,100,100]},
"Joe":{"ENG110":[90,90,70,70,80]}}
它的格式不会完全如图所示,它只是一个大列表,但我这样做了,所以很明显它应该如何组织。我什至不确定我是否知道从哪里开始。
翻翻过去那场雪
汪汪一只猫
缥缈止盈
相关分类