Remove Keys from Dictionary - Python

0
9K

In order to delete keys from the diction, you would have to use 'del'. Here's an example:

x  = {123: 456}

del x[123]

print(x)

>> {}

 

If the key doesn't exist in the dictionary, it'll throw an KeyError exception. 

Zoeken
Categorieën
Read More
Жизненные вопросы
Во имя отца. In the Name of the Father. (1993)
Эта драма основана на реальных событиях - истории «Гилфордской четверки». В 1975 году...
By Nikolai Pokryshkin 2023-03-27 12:21:56 0 26K
Programming
Python roblox-aio.py
roblox-aio.py is a Python Roblox API wrapper library that will have many features in the future....
By Jesse Thomas 2023-04-27 21:25:51 0 9K
Publications
Exploring the Evolution and Importance of Public Shopping Spaces
Exploring the Evolution and Importance of Public Shopping Spaces In the bustling tapestry of...
By Leonard Pokrovski 2024-06-01 11:49:36 0 28K
Social Issues
Heat. (1995)
A group of high-end professional thieves start to feel the heat from the LAPD when they...
By Leonard Pokrovski 2023-01-26 17:55:08 0 20K
Financial Services
Elasticity and tax revenue
Key points Tax incidence is the manner in which the tax burden is divided...
By Mark Lorenzo 2023-04-13 20:08:37 0 12K

BigMoney.VIP Powered by Hosting Pokrov