update a dictionary

    0

    3

    A snippet to update a dictionary in python

    Shortcut: upd

    dict1 = {'key1':}
    value1 = 'value1'
    
    dict1['key1'] = value1
    
    #or
    
    dict1.update({'key1' : value1})
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.