访问字典里的值
dict = {'name': 'zhangsan','age': 20,'class':"201"}
print("dict['name']:",dict['name'])
dict['name']: zhangsan
修改字典
dict['age'] = 19
print ("dict['age']:",dict['age'])
dict['age']: 19
增加信息
dict['school'] = "zfc"
print("dicr['school']:",dict['school'])
dicr['school']: zfc
删除字典里的值
del dict['class']
print(dict)
{'name': 'zhangsan', 'age': 19, 'school': 'zfc'}
清空字典
dict1 = {'name': 'zhangsan','age': 20,'class':"201"}
print (dict1)
{'name': 'zhangsan', 'age': 20, 'class': '201'}
dict1.clear()
print(dict1)
{}
删除字典
del dict1