Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Removing Elements from Python Dictionary Using popitem() 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 popitem() method
pop_element = Dictionary.popitem()
print('
Dictionary after deletion: ' + str(Dictionary))
print("The arbitrary pair returned is: " + str(pop_element))
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Removing #Elements #Python #Dictionary #Using #method
ADD COMMENT
Topic
Name
8+1 =