undergraduate_result =[
{"major": "Sociology1","href": "https://as.cornell.edu/sociology-major","note": "","type": "Bachelor's","college": "College of Arts and Sciences"},
{"major": "Sociology2","href": "https://as.cornell.edu/sociology-major","note": "","type": "Bachelor's","college": "College of Arts and Sciences"},
{"major": "Sociology3","href": "https://as.cornell.edu/sociology-major","note": "","type": "Bachelor's","college": "College of Arts and Sciences"},
{"major": "Sociology4","href": "https://as.cornell.edu/sociology-major","note": "","type": "Bachelor's","college": "College of Arts and Sciences"}
]
undergraduate_json = {}
for undergraduate in undergraduate_result:
if undergraduate["college"] in undergraduate_json:
undergraduate_json[undergraduate["college"]].append(undergraduate)
else:
undergraduate_json[undergraduate["college"]] = [undergraduate]
print(undergraduate_json)
==================以下为输出==========================