# create a dictionary students = {"Alice": 24, "Bob": 26, "Clark": 23, "Dan": 28, "Emma": 31} # add entry to a dictionary students[‘Fred‘] = 27 # alter an entry students[‘Alice‘] = 25 # delete entry del students[‘Fred‘] students2 = { "Alice": [‘ID01‘, 24, ‘A-‘], "Bob": [‘ID02‘, 26, ‘B+‘], "Clark": [‘ID03‘, 23, ‘B‘], "Dan": {‘id‘: ‘ID04‘, ‘age‘: 28, ‘grade‘: ‘A‘}, }
时间: 2024-11-03 22:17:29