python中坐标的排序

# pnts = [(-61.71012082459629, 121.75433432851878),
    #         (-62.51089283564055, 121.76620503121399),
    #         (-62.51089283564055, 121.76620503121399),
    #         (-63.85213198416312, 121.78680537058153),
    #         (-63.31165990286932, 121.77839603993561),
    #         (-27.359724659683103, 121.54670624834057),
    #         (-30.359724659681593, 121.54135092419187),
    #         (-33.36072002923211, 121.54049124100925),
    #         (-63.31165990286932, 121.77839603993561),
    #         (-63.31165990286932, 121.77839603993561),
    #         (-36.363942540435495, 121.54413408641767),
    #         (-39.36715620873955, 121.55228176274068),
    #         (-42.3703542769036, 121.56493425164649),
    #         (-45.37352998773221, 121.58209152466634),
    #         (-63.31165990286932, 121.77839603993561),
    #         (-48.37667658406437, 121.60375354319694),
    #         (-51.37978730881749, 121.62992025849826),
    #         (-48.410917047642265, 117.30388987202582),
    #         (-48.37667658406437, 121.60375354319717),
    #         (-51.42047753116557, 117.33011278538902),
    #         (-51.379787308817484, 121.62992025849849),
    #         (-57.82366914413058, 117.40092687042397),
    #         (-54.56742915604226, 117.36236146459078),
    #         (-60.95889244888201, 117.44305377461319),
    #         (-61.772997685142094, 117.45479406234949),
    #         (-62.575489507243425, 117.46669025975211),
    #         (-63.91952307212139, 117.48733349038116),
    #         (-63.377976120049155, 117.47890744716756),
    #         (-27.359724658776482, 117.24669246911753),
    #         ]
    # x_sorted = sorted(pnts, key=lambda tup: tup[0])
    # y_sorted = sorted(pnts, key=lambda tup: tup[1])

 

上一篇:2021-03-26


下一篇:列表和元组的区别以及常用方法