Answers for "remove last element from dictionary python"

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
0

remove dict last element

for k, v in listDict.items():
    v.pop()
Posted by: Guest on November-27-2020

Code answers related to "remove last element from dictionary python"

Python Answers by Framework

Browse Popular Code Answers by Language