Q:

get keys from specific value in dictionary

How can I get all keys which contain the specific value in dictionary?

For Example:- This is dictionary which holds simple data.  

{'h':['123,'4'], 'm':['456':'4'], 'a':['123,'4']}

If I enter a value of 4, prints all the keys which containing the number. This is the output.

{'h', 'm', 'a'}

A:

Since your result is a set, I would use a set constructor.
Since the value of your set depends on an iteration of your input data, I would pass a generator expression to the set constructor.
search_term = '4'
data = {'h':['123','4'], 'm':['456','4'], 'a':['123','4']}
result = set(k for k,v in data.items() if search_term in v)
assert result == {'h', 'm', 'a'}

