On 17/07/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Do you have any pointers on how to get from here > > continent = ["australia", "europe", "america", "asia"] > country = [["spain", "germany", "belgium"], ["united states", "canada"]] > state = ["california", "oregon", "arizona"] > > To here: > > geo=[ > ("australia", []), > ("europe", > [("spain",[]), > ("germany",[]), > > (belgium",[])]), > > ("north america", > [("united states",[ > ("california",[]), > ("oregon",[]), > ("arizona",[]) > ]) > ]), > ("canada", []), > ("asia", []) > ] > > ??
Hi Lauren, Basically, there is no way to do that because your lists don't contain any information about which coutries corerspond to which continents, et cetera. >From looking at your other email, my guess is that you want to start with SQL looking something like this: select continent, country, state from world_globe with the intention of getting back data that looks like: [('America', 'United States', 'California'), ('America', 'United States, 'Texas'), ('America', 'United States, 'Washington'), ('America', 'Canada', 'Ontario'), ('Asia', 'Japan', None), # etc ] It would be fairly straightforward to take data looking something like that and produce a tree. -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor