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. 

Pesquisar
Categorias
Leia mais
Television
WGN Live TV. Chicago, Illinois, USA.
WGN-TV, is a CW-affiliated television station locatedin Chicago, Illinois. Broadcasts started in...
Por Nikolai Pokryshkin 2022-10-31 12:25:16 0 29KB
Money
How Much Do YouTubers Make?
How Much Do YouTubers Make? YouTube has evolved from a video-sharing platform into a global hub...
Por Leonard Pokrovski 2025-09-23 19:15:01 0 6KB
Life Issues
Maleficent. (2014)
A vengeful fairy is driven to curse an infant princess, only to discover that the child may be...
Por Leonard Pokrovski 2023-05-03 20:52:38 0 26KB
Homeowners
How to rent an apartment - features of finding a tenant and common mistakes of landlords
Renting out an apartment is one of the ways to generate income for property owners. It seems that...
Por FWhoop Xelqua 2023-01-18 13:24:48 0 25KB
Социальные проблемы
Расёмон. Rashomon. (1950)
Древняя Япония. В лесу изнасилована женщина, а её муж убит. Есть четыре точки зрения на это...
Por Nikolai Pokryshkin 2023-02-25 13:44:25 0 22KB

BigMoney.VIP Powered by Hosting Pokrov