Making a tree out of a 2 column list
Sebastian Bassi
sbassi at clubdelarazon.org
Sat Apr 14 17:56:02 EDT 2007
More information about the Python-list mailing list
Sat Apr 14 17:56:02 EDT 2007
- Previous message (by thread): Making a tree out of a 2 column list
- Next message (by thread): Making a tree out of a 2 column list
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 14 Apr 2007 09:32:07 -0700, mensanator at aol.com <mensanator at aol.com> 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.
- Previous message (by thread): Making a tree out of a 2 column list
- Next message (by thread): Making a tree out of a 2 column list
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list