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
Personal Finance
What is Social Security — and Why You Need to Apply
What is Social Security — and Why You Need to Apply Social Security Administration (SSA)...
Par Leonard Pokrovski 2025-12-09 17:07:00 0 3KB
Business and Corporate Finance
What Are the Key Areas of Corporate Finance?
What Are the Key Areas of Corporate Finance? Corporate finance is a vital branch of finance that...
Par Leonard Pokrovski 2026-01-18 16:58:08 0 2KB
Business and Corporate Finance
What Does a CFO Do in a Small Business?
What Does a CFO Do in a Small Business? When people hear the title Chief Financial Officer...
Par Leonard Pokrovski 2026-01-13 18:31:37 0 1KB
Central America
Central America
Central America (Spanish: América Central) is a region located between the North American...
Par FWhoop Xelqua 2023-02-21 13:37:24 0 21KB
Телевидение
Прямая трансляция телеканала Москва 24
Городской круглосуточный информационный телеканал «Москва 24». Городские новости в...
Par Nikolai Pokryshkin 2022-10-10 11:27:59 0 30KB

BigMoney.VIP Powered by Hosting Pokrov