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
Διαβάζω περισσότερα
Top 15 Questions to Ask About Company Culture
Understanding a company’s culture is crucial when considering a new job, forming a...
10 countries with the largest gold reserves.
At the end of 2023, central banks around the world purchased 1037 tons of gold, the second...
Autism Spectrum: Alternative medicine
A multitude of researched alternative therapies have also been implemented. Many have resulted in...
Your guide to key tax terms
1. Gross and taxable income
Gross income is your total income over the course of the year....
Command-and-control regulation
Key points
Command-and-control regulation sets specific limits for pollution...