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
История
Семейка Крудс: Новоселье. The Croods: A New Age. (2020)
Такие харизматичные герои как члены клана Крудс просто не в силах усидеть на месте. Они смело...
Par Nikolai Pokryshkin 2022-09-11 21:56:14 0 23KB
Business
How Do I Start a Pitch?
Introduction: Why the Beginning of a Pitch Matters More Than You Think The first 30–60...
Par Dacey Rankins 2025-12-03 15:38:46 0 3KB
Economics
What Is the Northern Ireland Protocol?
What Is the Northern Ireland Protocol? The Northern Ireland Protocol is a key part of the Brexit...
Par Leonard Pokrovski 2026-02-04 00:12:13 0 2KB
Научная фантастика и фэнтези
Человек-паук: Через вселенные. Spider-Man: Into the Spider-Verse. (2018)
Мы всё знаем о Питере Паркере. Он спас город, влюбился, а потом спасал город снова и...
Par Nikolai Pokryshkin 2022-12-22 21:20:45 0 22KB
Cooking
Easy Bananas Foster Recipe !
Bananas Foster Recipe Easy IngredientsTo make this dessert you'll need: salted butterbrown...
Par FWhoop Xelqua 2023-05-09 17:22:31 0 22KB

BigMoney.VIP Powered by Hosting Pokrov