for student_id in range(1,len(student)+1):
for test_id in range(len(marks)):
if marks["student_id"][test_id] == student_id:
test_list.append(marks["test_id"][test_id])
test_dict[student_id] = [test_list]
test_list.clear()
print(test_dict)
在将列表添加到字典之前,我做了一些测试,列表中包含一些结果,但在字典中它是空的。当我在网上搜索时,一切看起来都很正常
更像Python的方式是这样的:
相关问题 更多 >
编程相关推荐