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 196 views
2 answers 244 views
2 answers 189 views
2 answers 235 views
1 answer 177 views
2 answers 243 views
1 answer 177 views
...