Sorting and Grouping Nested Lists in Python

后端 未结 8 1607
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 20:05

I have the following data structure (a list of lists)

[
 [\'4\', \'21\', \'1\', \'14\', \'2008-10-24 15:42:58\'], 
 [\'3\', \'22\', \'4\', \'2somename\', \'2         


        
8条回答
  •  佛祖请我去吃肉
    2020-11-30 20:44

    It looks a lot like you're trying to use a list as a database.

    Nowadays Python includes sqlite bindings in the core distribution. If you don't need persistence, it's really easy to create an in-memory sqlite database (see How do I create a sqllite3 in-memory database?).

    Then you can use SQL statements to do all this sorting and filtering without having to reinvent the wheel.

提交回复
热议问题