python delete last item in dictionary code example
Example 1: 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
Example 2: remove dict last element
for k, v in listDict.items():
v.pop()