لغت نامه های تو در تو(Nested Dictionaries)

یک فرهنگ لغت همچنین می‌تواند شامل لغت‌نامه‌های زیادی باشد که به آن لغت‌نامه تودرتو می‌گویند.
لغت نامه ها.



مثال


Create a dictionary that contain three dictionaries:



myfamily = {
  "child1" : {
    "name" : "Emil",

    "year" : 2004
  },
  "child2" : {
   
"name" : "Tobias",
    "year" : 2007
  },
 
"child3" : {
    "name" : "Linus",

    "year" : 2011
  }
}




یا اگر می‌خواهید سه دیکشنری را که از قبل وجود دارد، تودرتو کنید
فرهنگ لغت:




مثال


Create three dictionaries, than create one dictionary that will contain the
other three dictionaries:



child1 = {
  "name" : "Emil",
  "year" : 2004
}
child2 = {
 
"name" : "Tobias",
  "year" : 2007
}
child3 = {
  "name" : "Linus",
 
"year" : 2011
}

myfamily = {
  "child1" : child1,
 
"child2" : child2,
  "child3" : child3
}