Answers for "dictionary del 2nd last key"

0

remove last element from dictionary python

D={1:'a',2:'b',3:'c'}
x=D.popitem()
print(D,x)
>>>{1:'a',2:'b'} (3,'c')
#x is the removed item, D is the rest of the dict
Posted by: Guest on September-03-2020

Python Answers by Framework

Browse Popular Code Answers by Language