Sort list of dictionaries

    0

    5

    Python public recipes

    sorted will create a new list based on the original list and provide a key to use to compare items.

    new_list = sorted(original_list, key=lambda item: item.get("entry_to_sort"))
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.