Best way to sort 1M records in Python

前端 未结 11 1643
慢半拍i
慢半拍i 2020-12-05 08:41

I have a service that runs that takes a list of about 1,000,000 dictionaries and does the following

myHashTable = {}
myLists = { \'hits\':{}, \'misses\':{},          


        
11条回答
  •  囚心锁ツ
    2020-12-05 09:24

    If you have a fixed number of fields, use tuples instead of dictionaries. Place the field you want to sort on in first position, and just use mylist.sort()

提交回复
热议问题