Hi, Basically you can sort any list by passing a key as follows:
base_location = (x,y) locations = [(x1, y1), (x2, y2), ....(xn, yn)] def distance_between(geocordinate1, geo_cordinate2): ''' write your code here to return the distance between two cordinates you can use google maps api for this. '''' pass *locations.sort(key = lambda x: distance_between(x, base_location))* #sorts the list in-place Regards, Abdul Muneer -- Follow me on Twitter: @abdulmuneer <http://twitter.com/#%21/abdulmuneer> On Tue, Apr 16, 2013 at 12:17 PM, Smrutilekha Swain <smrutile...@gmail.com>wrote: > i am writing a program using PyQt4. i have created a table containg name of > the instruments, locations, its latitudes, longitude and altitude. > > there may be two instruments and its locations are same but different > latitude and longitude with mild difference. > > so now i want to sort the table by latitude or longitude whose have least > difference... > > can u plz give me sume hints or guidance how to do..... > > > thanzzzzzzz in advance..........waiting for ur reply............ > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers