Monday, 10 May 2021

How to check if one dictionary key and value exists in another dictionary

 

for keys and values check use: set(d1.items()).issubset(set(d2.items()))

if you need to check only keys: set(d1).issubset(set(d2))


No comments:

Post a Comment