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
Financial Services
Indexing and its limitations
Key points A payment is said to be indexed if it is automatically...
Par Mark Lorenzo 2023-03-06 20:56:29 0 13KB
Business
Is Your Boss Talking Too Much?
In the workplace, communication is critical—but it’s a two-way street. When one voice...
Par Dacey Rankins 2025-06-03 13:39:57 0 9KB
Financial Services
The economics of pollution
Key Points Economic production can cause environmental damage. This tradeoff...
Par Mark Lorenzo 2023-01-31 15:07:38 0 14KB
Nature and Science
My Octopus Teacher (2020)
A filmmaker forges an unusual friendship with an octopus living in a South African kelp forest,...
Par Leonard Pokrovski 2023-07-12 20:39:24 0 30KB
История
Сокровища Сьерра-Мадре. The Treasure of the Sierra Madre. (1948)
В небольшом мексиканском городке Тампико знакомятся два бедняка Доббс и Кертин. От местного...
Par Nikolai Pokryshkin 2023-02-19 18:34:14 0 23KB

BigMoney.VIP Powered by Hosting Pokrov