Remove Keys from Dictionary - Python
Posted 2023-02-23 23:16:41
0
6K
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.
Buscar
Categorías
- Arts
- Business
- Computers
- Juegos
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
Yard, Deck, and Table Games: Classic Fun for All Ages
Games have always been a great way to bring people together, whether you’re enjoying a...
Health Education: Empowering Individuals and Communities for Better Health
Health education is a vital component of public health that aims to empower individuals and...
Огни большого города. City Lights. (1931)
Маленький Бродяга встречает красивую слепую девушку, торгующую цветами на улице, которая по...
Престиж. The Prestige. (2006)
Роберт и Альфред - фокусники-иллюзионисты, которые на рубеже XIX и XX веков соперничали друг с...
Why is Business Ethics Important?
In today's highly competitive and interconnected world, business ethics plays an essential role...