Remove Keys from Dictionary - Python
Postado 2023-02-23 23:16:41
0
12K
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
- Arts
- Business
- Computers
- Jogos
- Health
- Início
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia Mais
The Thrill and Endurance of Cycling Sports: A Journey on Two Wheels
The Thrill and Endurance of Cycling Sports: A Journey on Two Wheels...
Fox 13 Salt Lake City. Live TV. USA.
Fox 13 (KSTU), is a Fox-affiliated television station located in Salt Lake City, Utah, United...
Food and Related Products: The Heart of Global Industry and Culture
Food is essential to life, but it is also much more than a biological necessity. The production,...
What Are Common Mistakes Companies Make During M&A?
Mergers and acquisitions (M&A) represent some of the most ambitious, complex, and high-stakes...
Gifted. (2017)
Frank, a single man raising his child prodigy niece Mary, is drawn into a custody battle with his...