1 student = {1: 'jack', 2: 'swq', 3: 'zyg'} 2 print(student[2]) 3 4 #del 删除 5 del student[2] 6 print(student) 7 8 #clear 清空 9 student.clear() 10 print(student)
执行结果
1 student = {1: 'jack', 2: 'swq', 3: 'zyg'} 2 print(student[2]) 3 4 #del 删除 5 del student[2] 6 print(student) 7 8 #clear 清空 9 student.clear() 10 print(student)
执行结果