Remove Keys from Dictionary - Python

0
9χλμ.

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. 

Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Mental Health
Psychosis: Disorganization of speech/thought or behavior
Disorganization is split into disorganized speech (or thought), and grossly disorganized motor...
από Kelsey Rodriguez 2023-05-16 18:26:01 0 10χλμ.
Hospitality
The Future of Hospitality: Trends and Innovations Shaping the Industry in 2024
The hospitality industry is one of the most dynamic sectors of the global economy, constantly...
από Dacey Rankins 2024-11-06 18:06:56 0 9χλμ.
Телевидение
Телеканал ТВТУР.TV прямая трансляция Русский и English
Твтур.ТВ - телеканал об удивительных путешествиях по странам и континентам. Уникальные фильмы о...
από Nikolai Pokryshkin 2022-11-06 20:25:07 0 24χλμ.
Социальные проблемы
Неистовый. Unhinged. (2020)
Мать-одиночка Рейчел находится в процессе развода, и этот день у неё не задался. Она проспала и,...
από Nikolai Pokryshkin 2022-10-16 17:51:15 0 25χλμ.
Journals
Key Elements of Explorers' Journals
Explorers' journals are an essential part of the history of exploration, providing firsthand...
από Dacey Rankins 2024-12-02 14:10:20 0 7χλμ.

BigMoney.VIP Powered by Hosting Pokrov