How to replace all None values with the string "Null" in a dictionary

skip at pobox.com skip at pobox.com
Thu Oct 27 16:42:11 EDT 2005


    Daniel> How can I replace all None values with the string 'Null' in a
    Daniel> dictionary?

    a = {'item1': 45, 'item2': None}
    for key in a:
        if a[key] is None:
            a[key] = "Null"

Skip



More information about the Python-list mailing list