Remove Keys from Dictionary - Python
Δημοσιευμένα 2023-02-23 23:16:41
0
12χλμ.
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.
Αναζήτηση
Κατηγορίες
- Arts
- Business
- Computers
- Παιχνίδια
- Health
- Κεντρική Σελίδα
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Διαβάζω περισσότερα
ChatGPT The Beautiful Game: A Celebration of Football
Football, known as soccer in some parts of the world, transcends mere sport to become a global...
Невероятная история Острова роз. Rose Island. (2020)
Инженер-идеалист Джорджо Роза решил построить независимое государство и создал искусственную...
What Strategies Are Best When Marketing on a Tight Budget?
Introduction
Every marketer dreams of having a large, flexible budget — the kind that...
Baby Money. (2021)
When a home invasion turns into a bloody shoot-out, a pair of ragtag fugitives take refuge in the...
Platoon. (1986)
Chris Taylor, a neophyte recruit in Vietnam, finds himself caught in a battle of wills between...