How can I remove a key from a Python dictionary?
When deleting a key from a dictionary, I use:
if 'key' in my_dict:
del my_dict['key']
Is there a one line way of doing this?
When deleting a key from a dictionary, I use:
if 'key' in my_dict:
del my_dict['key']
Is there a one line way of doing this?