How should I define a function parsedic()
which works like?
dic={0:0,
1:{0:0,
1:1,
2:{0:0,},},
2:{0:{1:0,
0:{0:0}},},
3:0}
def parsedic(...):
...
print parsedic(dic)
results:
0->0
3->0
1.0->0
1.1->1
1.2.0->0
2.0.0.0->0
2.0.1->0
The type of the key of the dict can only be a number or string, and the value can only be a number, string, or dict.
(To avoid misunderstandings, I deleted the words which showed how I've tried to solve this question for a long time.)