clueless newbie question

MCM absolutniks at hotmail.com
Sat Sep 23 17:07:45 EDT 2000


Thanks

--
put your speakers to the test:
http://listen.to/statiksounds/
"Alex" <cut_me_out at hotmail.com> schreef in bericht
news:etd66no9bel.fsf at oliver.mit.edu...
>
> Matthijs
> > I would like to construct a html page that shows all these threads in
> > a nice and orderly fashion, but don't know how to go about setting up
> > the recursion you would get by pulling out subthreads, then parent
> > threads, etc.
>
> Make a tree, then print that out.  Something like this untested code:
>
> def make_tree(message_list):
>     tree = {'messages': []}
>     for message_id, message in message_list:
>         current_branch = tree
>         for id_number in string.split(message_id):
>             current_branch = tree.get(id_number, {'messages': []})
>         current_branch['messages'].append(message)
>
> def print_tree(message_tree, depth=0, indentation_depth=4):
>     for message in message_tree['messages']:
>         print message
>         child_ids = message_tree.keys()
>         child_ids.remove('message')
>         for id_number in child_ids:
>             print_tree(message_tree[id_number],
>                        depth, indentation_depth+4)
>
> Alex.
>
> --
> Speak softly but carry a big carrot.
>




More information about the Python-list mailing list