[Tutor] Tree Ctrl Data Structure - Help, please!
motoom at xs4all.nl
Wed Jul 16 01:28:18 CEST 2008
> Based on some research I've done, I think I want my data structure to
> be a series of lists within lists:
> Can someone give me some pointers on how to think about this
> clearly?? I'm obviously missing some steps!! :-(
I find your example a bit hard to follow. From the node names I can't
determine a logical hierarchy; it might be the formatting of the email message.
Could you express the way you get your query results in terms of the below
geography names? Then maybe I can think up a way how to combine those lists
into a tree.
# start of example
# this example uses a hierarchy of three levels: 1) continent, 2)
country/state, and 3) city
print "Our geography as a flat list:\n"
for item in lst:
print " -> "*indent, item
print "\nOur geography as a tree:\n"
# end of example
Our geography as a flat list:
['australia', 'europe', ['spain', 'germany', 'belgium'], 'america',
['california', ['los angeles', 'san francisco', 'berkeley'], 'texas',
Our geography as a tree:
-> -> los angeles
-> -> san francisco
-> -> berkeley
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
More information about the Tutor