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 195 views
2 answers 240 views
2 answers 185 views
2 answers 229 views
1 answer 176 views
2 answers 238 views
1 answer 176 views
...