Keys in dict and keys not in dict

Andrew Z formisc at gmail.com
Sun Mar 18 23:32:02 EDT 2018


hello,

 i'd like to check if a function parameter (json) has all the keys I expect
it to have and if it doesn't - point out the one that is missing.

 What's the good way of doing that?

"good way" - something concise... i'd like to avoid using :
 if key in json:
    #pass
 else
   print(" Oops, i did it again ...")

thank you
AZ



More information about the Python-list mailing list