Q:

How to check if dictionary has certain key (Python)

I'm having a defaultdict dictionary that has keys like this:
RJECNIK['*','A']['<A>']

now i don't know how to check if there is a key, for example:
a=list(RJECNIK.keys())

gives me the list of only first keys (['*','A']).
In my code I need an if statement
if key in RJECNIK:
    ...
But it doesn't work since I don't know how to check for a PAIR of keys in defaultdict with 2 keys. 

A:

You need to check for both keys in both dictionaries:
key = ('*', '<A>')
if key[0] in RJECNIK and key[1] in RJECNIK[key[0]]:
    pass

