#Python 3.X 里不包含 has_key() 函数,被 __contains__(key) 替代:
dict3 = {'name':'z','Age':7,'class':'First'};
print("Value : ",dict3.__contains__('name'))
print("Value : ",dict3.__contains__('sex'))
#执行结果:
Value : True
Value : False
Dictionary 是否含键值
猜你喜欢
转载自blog.csdn.net/jiekaile/article/details/102872643
今日推荐
周排行