Python dictionary 字典 常用法
Python dictionary 字典 常用法
d = {}
d.has_key(key_in) # if has the key of key_in
d.keys() # keys list
d.values() # values list
d.get(key_in,[defualt]) # it will return 'NoneType' or [default] if with the second argument, if dict has no key of key_in, it will raise error with d[key_in]
if d: # if d is empty, it will be False
未经博主允许,禁止直接转载本博客任何内容(可以在文章中添加链接,禁止原文照搬),如需直接原文转载对应文章,请在该文章中留言联系博主,谢谢!!

浙公网安备 33010602011771号