草庐IT

gridKeys

全部标签

python - 如何按第一个元素对元组列表进行排序?

我有一个元组列表:self.gridKeys=self.gridMap.keys()#ThekeysoftheinstanceoftheGridMap(Itreturnstheproductofeverypossiblecombinationofpositionsinthespecifiedgrid,intuples.)printself.gridKeysself.gridKeys:[(7,3),(6,9),(0,7),(1,6),(3,7),(2,5),(8,5),(5,8),(4,0),(9,0),(6,7),(5,5),(7,6),(0,4),(1,1),(3,2),(2,6),