Remove Keys from Dictionary - Python
Posted 2023-02-23 23:16:41
0
8K
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.
Search
Categories
- Arts
- Business
- Computers
- Games
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
Chemistry: The Science and Art of Matter
Chemistry plays a central role both due to its place among the natural and cognitive sciences,...
Последний Парадизо. The Last Paradiso. (2021)
Италия, 1950-е.Свободолюбивый фермер борется за лучшие условия труда.Он мечтает о любви,...
What Are the Best Ways to Finance a Startup?
Starting a business requires capital, and securing the right funding can determine the success or...
How well GDP measures the well-being of society
Key points
GDP is an indicator of a society’s standard of living, but it is...
Emmanuel Live TV (English) Nigeria.
Emmanuel TV is a Christian TV Network. The channel is headquartered in Lagos, Nigeria and founded...