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
Gymnastics
The Graceful Artistry of Gymnastics: A Sport of Power, Precision, and Poise
The Graceful Artistry of Gymnastics: A Sport of Power, Precision, and Poise Gymnastics, often...
Par Leonard Pokrovski 2024-06-27 18:32:34 0 24KB
Entertainment
Exploring Kids and Teens Entertainment: From Screen Time to Creative Play
Exploring Kids and Teens Entertainment: From Screen Time to Creative Play Entertainment plays a...
Par Leonard Pokrovski 2024-04-30 15:11:22 0 39KB
Business
How Do You Train a Sales Team?
Training a sales team is one of the most impactful investments a company can make. Even the most...
Par Dacey Rankins 2025-12-19 19:39:44 0 3KB
Retail Trade
Retail
Retail trade is the business activity of selling goods or providing services directly to end...
Par Dacey Rankins 2024-03-18 17:20:11 0 26KB
Социальные проблемы
Джанго освобождённый. Django Unchained. (2012)
Шульц — эксцентричный охотник за головами, который выслеживает и отстреливает самых опасных...
Par Nikolai Pokryshkin 2022-12-13 22:37:48 0 27KB

BigMoney.VIP Powered by Hosting Pokrov