Python delete a value from dictionary and not the key
<p>Is it possible to delete a value from  a dictionary and not the key? For instance, 
I have the following code in which the user selects the key corresponding to the element that he wants to delete it , but I want do delete only the value and not the key ( the value is a list): </p>

<pre><code>if (selection == 2):
    elem = int(input("Please select the KEY that you want to be deleted: "))
    if dictionar.has_key(elem):
        #dictionar.pop(elem)
        del dictionar[elem]
    else:
        print("the KEY is not present ")
</code></pre>

<p>Dictionaries are data structures with <code>{key:value}</code> pairs.</p>

<p>To work with values, you can do replace the value with some other value or <code>None</code> like below:</p>

<pre><code>dic = {}
e = int(input("KEY to be deleted/replaced: "))    

if dic.has_key(e):
    r = int(input("New value to put in or just press ENTER for no new value"))
    if not r:
       r=None
    dic[e]=r
else:
    print("Key Absent")
</code></pre>

python