python——判斷字典中是否有鍵key
提問人:楊紫紅發(fā)布時間:2020-11-20
l = [1, 2, 3]
t = (1, 2, 3)
d5 = {1:"one", 2:"two", 3:"three"}
print d5.get(1) #one
print d5.get(5) #None
print d5.get(5, "test") #test
has_key(key) ---判斷字典中是否有鍵key
繼續(xù)查找其他問題的答案?
相關(guān)視頻回答
l = [1, 2, 3]
t = (1, 2, 3)
d5 = {1:"one", 2:"two", 3:"three"}
print d5.get(1) #one
print d5.get(5) #None
print d5.get(5, "test") #test
has_key(key) ---判斷字典中是否有鍵key
點擊加載更多評論>>