Remove Keys from Dictionary - Python

0
7K

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. 

Pesquisar
Categorias
Leia Mais
Телевидение
Телеканал Доктор Градус. Прямая трансляция.
Телеканал «Доктор Градус» целиком посвящен нетрадиционной медицине. При просмотре...
Por Nikolai Pokryshkin 2022-11-18 12:54:04 0 18K
Jogos
New Year's games
A home New Year's holiday is a long-standing good tradition. Older family members want to give...
Por FWhoop Xelqua 2022-12-06 16:18:49 0 34K
Социальные проблемы
Охотник на оленей. The Deer Hunter. (1978)
История о трех американцах русского происхождения - их жизни до, во время и после войны во...
Por Nikolai Pokryshkin 2023-03-30 09:58:29 0 20K
Business
Flower business at home
Flower business at home Opening a flower business at home can be a great idea...
Por Leonard Pokrovski 2024-07-22 21:02:09 0 14K
Stories
The Third Man. (1949)
Pulp novelist Holly Martins travels to shadowy, postwar Vienna, only to find himself...
Por Leonard Pokrovski 2023-04-01 20:19:07 0 33K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov