How to remove an arbitrary (key, value) pair from the dictionary in Python

1 Answer

0 votes
dic = {'a': 'python', 'b': 'java', 'c': 'php', 'd': "c#"}

dic.popitem()
dic.popitem()

print(dic)


'''
run:

{'a': 'python', 'd': 'c#'}

'''

 



answered Dec 5, 2017 by avibootz

Related questions

1 answer 186 views
2 answers 221 views
2 answers 167 views
2 answers 209 views
1 answer 158 views
2 answers 231 views
1 answer 164 views
...