Relative Content

Tag Archive for pythonsortingsortedlist

Sorting the list of dictionaries

s = [ { "requisites": { "partyId": "722725f9-0b34-4835-93cf-fa3d588dbc13", "organizationId": "45ba6290-d4da-431e-bfd5-47e2d1be6806", "organizationGln": "2235515362949", "organizationType": "ShipperOrConsignee", "organizationRegistrationDate": "" } }, { "requisites": { "partyId": "722725f9-0b34-4835-93cf-fa3d588dbc13", "organizationId": "3fba6290-d4da-431e-bfd5-47e2d1be6806", "organizationGln": "2128483838953", "organizationType": "PayerOrBuyer", "organizationRegistrationDate": "2025-11-29T00:00:00Z" } }, { "requisites": { "partyId": "722725f9-0b34-4835-93cf-fa3d588dbc13", "organizationId": "3fba6290-d4da-431e-bfd5-47e2d1be6806", "organizationGln": "2128483838953", "organizationType": "PayerOrBuyer", "organizationRegistrationDate": "2025-11-29T00:00:00Z" } }, { "requisites": { "partyId": "722725f9-0b34-4835-93cf-fa3d588dbc13", "organizationId": "45ba6290-d4da-431e-bfd5-47e2d1be6806", "organizationGln": "2235515362949", "organizationType": "ShipperOrConsignee", "organizationRegistrationDate": "" } } ]
The list may contain more than a thousand dictionaries.
How can I sort the following list so that dictionaries with the value PayerOrBuyer always appear first in the list?