Daniella Sapozhnikova <[email protected]> writes: > 1) If I wanted to combine two dictionaries into one, how would I go > about doing so?
How to do it depends on what policy you want to adopt for duplicate keys: * Existing item stays? * New item overrides existing item? * Something else happens? > (the .update method?) The ‘dict.update’ method is good, yes. It requires that you be explicit about which items you are updating in the existing dictionary. > 2) How can I make that combined dictionary have inner dictionaries > with the inner values from the previous separate dictionaries? That will be easier to talk about if you give some sample inputs and the expected output from the operation. -- \ “I find the whole business of religion profoundly interesting. | `\ But it does mystify me that otherwise intelligent people take | _o__) it seriously.” —Douglas Adams | Ben Finney _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
