Avatar ·

The overkill of the key-value in 2 or more dictionaries and the recording of coincidence in the new dictionary through *args

📁 словарь, python, помощь, ошибка

There are two dictionaries, you need to sort out the key-meaning in both dictionaries. Compare if the same key-knowledge using the FOR cycle and the *argys parameter. Add the same key-meaning found to the new dictionary.

  Operator_one = { 2 :  'break' ,   1 :  '`` `` `` `" ",   3 : ' print ', ,   4 :  'yield' ,   5 :  '' 'try' , } operator = { 1 :  'pass' ,   2 : ' 'global' ,   3 :  'yield' ,   4 :  '' 'print' ,   5 :  '' try ', , , . }   def   operator_important  ( farg, *args ):   "" "" "overbus of the key-knowing in two dictionaries in two dictionaries ARGS help and entries in the new dictionary. "" "" "  operator_main =  dict  () # Creating in the shift    print  ( "" vocabulary_one: "" , farg) # the output of the first argument    for  key, value  in  args: # The key to the key-meaning in both dictionaries    print  (, arg) Argument    if  key  in  args  and  value == args [key]: # The key-value, we create a new dictionary with a key and value   oparator_main [key] = value # Add to new. The dictionary of the found key, which coincided with      

Error:

valueerror: too many valuses to unpack