I have a python dict (read from a json file) like the one below:
{ 'a' :
{ 'b' :
{ 'c': 3,
'd': 4}
}
}
What is the best way to identify the total number of keys, including sub-keys? In the above example the desired answer would be 4 ('a','b','c','d'). Is there a way to do this without just creating a for loop and iterating through?