[web2py] Re: How do I group the list by value and make it table in HTML?

2012-03-22 Thread Wikus van de Merwe
You can simply loop over a sorted list (first by the state, then by name): city_list = [('Huntsville', 'AL'), ('Decatur', 'AL'), ('Anchorage', 'NV'), ('Nome', 'AK'),('Selma', 'AL'), ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')] sorted_list = sorted(city_list, key=lambda x:

[web2py] Re: How do I group the list by value and make it table in HTML?

2012-03-18 Thread Kenny
I think I will just do it with this way.. I created two lists (one is for states,one is for city and state) And I just compared them by for loops. sorry for newb question as I am new to python. On 3월18일, 오전12시21분, Kenny nis...@gmail.com wrote: I have city_list = [('Huntsville', 'AL'),