Dictionary to tree format (hopefully simple)

2008-08-05 Thread Adam Powell
Hi! I have seemingly simple problem, which no doubt someone out there has already solved, but I'm stumped. Imagine I have a dictionary like below, in which the keys are parent nodes and the values are a list of children nodes. dict = { 0: [1, 2], 1: [3], 2: [6], 3: [4,7], 4: [5,8], 8: [9] } Is th

Re: Dictionary to tree format (hopefully simple)

2008-08-06 Thread Adam Powell
Thanks very much for this, very concise! -- http://mail.python.org/mailman/listinfo/python-list