0

I'm trying to add dictionary with new key to another dictionary but I don't know how to code in python

For example, if I have two dictionary like this:

dic_A = {"A": a, "B": b}
dic_C = {"E": e, "F": f}

And I want to add dic_C to dic_A with new key "C" as nested dictionary like this:

dic_A = {"A": a, "B": b, "C": {"E": e, "F": f}}
Chris
  • 29,127
  • 3
  • 28
  • 51
88tea
  • 15
  • 1

1 Answers1

0

You need to add a new Key in dic_A with values of dic_C as below.

dic_A['c'] = dic_C
Mithilesh_Kunal
  • 873
  • 7
  • 12