Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Removing Elements from Python Dictionary Using pop() method

# welcome to softhunt.net
# Creating a Dictionary
Dictionary = {0: 'Softhunt', 1: '.net', 2: 'By Ranjeet', 'user': 'Greetings to you'}
print("Dictionary", Dictionary)

# Deleting a key
# using pop() method
pop_element = Dictionary.pop(2)
print('
Dictionary after deletion: ' + str(Dictionary))
print('Value associated to poped key is: ' + str(pop_element))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Removing #Elements #Python #Dictionary #Using #method
ADD COMMENT
Topic
Name
8+3 =