clueless newbie question

Alex cut_me_out at
Sat Sep 23 02:53:22 CEST 2000

> 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': []})

def print_tree(message_tree, depth=0, indentation_depth=4):
    for message in message_tree['messages']:
        print message
        child_ids = message_tree.keys()
        for id_number in child_ids:
                       depth, indentation_depth+4)


Speak softly but carry a big carrot.

More information about the Python-list mailing list