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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-10-04
  • 2021-06-19
  • 2021-07-30
猜你喜欢
  • 2021-12-22
  • 2021-12-22
  • 2021-09-30
  • 2021-09-27
相关资源
相似解决方案