Remove Keys from Dictionary - Python
Posted 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.
Search
Categories
- Arts
- Business
- Computers
- Games
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
How Much Should I Have Saved by Age 20/30/40/50/60?
How Much Should I Have Saved by Age 20/30/40/50/60?
“How much should I have saved by...
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...
Python Datetime
Datetime in Python is the combination between dates and times. The attributes of this class are...
Ford против Ferrari. Ford v Ferrari. (2019)
В начале 1960-х Генри Форд II принимает решение улучшить имидж компании и сменить курс на...
The Evolution of Military Strategy: From Ancient Tactics to Modern Warfare
The Evolution of Military Strategy: From Ancient Tactics to Modern Warfare
Introduction: The...