Dictionary 是否含键值

mac2026-08-23  0

#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
最新回复(0)