[Tutor] How to find descendants recursively?
Timo
timomlists at gmail.com
Sun Jun 16 19:20:49 CEST 2013
I have a datafile which is parsed by an external library, I'm having
trouble creating a hierarchical structure of the data.
This is what I got so far:
items = get_items() # returns a generator
for item in items:
print(item)
children = get_children(item) # also returns a generator
for child in children:
print("--", child)
This is fine as it will get the children for each parent item. I can't seem
to figure out how to go further and get the chidren of the children and so
on.
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130616/ee888ebe/attachment.html>
More information about the Tutor
mailing list