Python Dictionary

Creator
Creator
Seonglae Cho
Created
Created
2021 May 31 7:7
Editor
Edited
Edited
2024 Jun 11 1:37
  • keys() - dict_keys type
  • values() - dict_values
  • items() - tuple - dict_items
for key, value in dict.items(): blabla
Python Dictionary notion
 
 
Python Dictionary Usages
 
 

Subset

a = {'id': '123', 'type': 'admin', 'status': 'active'} b = {'id': '123', 'type': 'admin'} # To check if b is a subset of a: result = b.items() <= a.items() print(result) # Output: True
 
 
dict[key] kill program when there is no key, but get(key) return none (or key in dict)
PyPrnt - prnt beauty list and dictionary
 
 
 
 

Recommendations