On 14 Apr 2007 09:32:07 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> def tree_path(key,tree,indent):
>     print '\t'*indent,key
>     if tree.has_key(key):
>         for m in tree[key]:
>             tree_path(m,tree,indent+1)
>     return

Thank you. It worked!.
I changed it a bit to return a list with the results:

def tree_path(key,tree,hijos):
        hijos.append(key)
        if tree.has_key(key):
                for m in tree[key]:
                        tree_path(m,tree,hijos)
        return hijos

Then I call it like this:

MyList=tree_path(9608,tree,[])

Best,
SB.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to