dictdictdictdict
info={'name':'章子怡','actress':'big star'}
print(info['name'])
print(info['actress'])
x=info.get('agee')
print(x)
#这个确实是get方法啊,因为没有这个值的会返回是null,而不是报错。
info={'name':'章子怡','actress':'big star'}
print(type(info))
age=info.get('agee',36)
print(age)
#没有值的话就给它赋值一个默认值36
------------------------------------------------------修改info['ac'tress]
info={'name':'章子怡','actress':'big star'}
print(type(info))
age=info.get('agee',36)
print(age)
info['actress']='international star'
print(info)
------------------------------------------------------------------------------
info={'name':'章子怡','actress':'big star'}
print(type(info))
age=info.get('agee',36)
print(age)
info['actress']='international star'
print(info)
info['gender']='female'
print(info)
del info['gender']
print(info)
print(len(info))
print(info.keys())
print(info.values())
print(info.items())#获取字典的元素视图,该视图会实时地反映出字典中键值对的变化
info.clear()
print(info)
--------------------------enumerate-----------------枚举