How to compare the values ​​of the dictionary with a variable, according to the condition for example? I apologize if I do not express myself correctly.

  • Specify the condition. With an example, if you can. - moden
  • Need clarification, because the dictionary can be compared only with the dictionary. And with a variable, you can compare either the key (by taking it from the tuple of keys obtained using keys ()), or with the value by key - Ekkertan

2 answers 2

if dict_data['entry_name'] == variable: … 

    It seemed to me that you mean how to find out if the dictionary contains a value equal to a variable. This is done like this:

     if variable in dictionary.values(): ...