【问题标题】:Sort 2D list based on second column根据第二列对二维列表进行排序
【发布时间】:2016-02-29 21:31:23
【问题描述】:

我正在用 Python 对二维列表进行排序。现在,我根据第一列按升序对列表进行了排序。我的列表如下所示:

Enter image description here

现在仅根据第二列对第一列具有相同元素的行进行排序。它应该是这样的:

Enter image description here

【问题讨论】:

标签: python list sorting 2d


【解决方案1】:

我相信你是在问这两个问题的组合:

  1. 如何在 Python 中按多个属性对列表进行排序:Sort a list by multiple attributes?.

  2. 如何在 Python 中按日期排序:How do I sort this list in Python, if my date is in a String?

希望这些答案有所帮助。

【讨论】:

    猜你喜欢
    • 2018-08-17
    • 1970-01-01
    • 2022-01-10
    • 1970-01-01
    • 1970-01-01
    • 2014-11-29
    • 1970-01-01
    • 2021-10-28
    • 2013-12-16
    相关资源
    最近更新 更多