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)
#沒有值的話就給它賦值一個默認(rèn)值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-----------------枚舉