Remove Keys from Dictionary - Python

0
12KB

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. 

Rechercher
Catégories
Lire la suite
Другое
Рождество на двоих. Last Christmas. (2019)
Кейт работает в магазине рождественских товаров, злоупотребляет выпивкой и давно бросила...
Par Nikolai Pokryshkin 2022-09-11 23:04:49 0 29KB
Business
What Common Mistakes Should Be Avoided When Writing a Startup Biography?
Writing a startup biography can be a powerful way to communicate the essence of a company, its...
Par Dacey Rankins 2025-04-21 18:12:23 0 9KB
Video Games
The best video games of the XXI century
Ranked 10th TOP Bloodborne, released on the PlayStation 4 in 2015, is located. On the...
Par FWhoop Xelqua 2023-01-17 17:02:41 0 19KB
Aging
Science vs. Old Age. How to Accelerate Evolution and Be Forever Young
There are animals that can be called evolutionary champions. They just turned off aging and can...
Par Dacey Rankins 2024-04-12 18:02:22 0 15KB
Argent
How to Invest
How to Invest Investing is one of the most powerful ways to grow wealth and secure your...
Par Leonard Pokrovski 2025-09-22 19:14:53 0 4KB

BigMoney.VIP Powered by Hosting Pokrov