Remove Keys from Dictionary - Python
Postado 2023-02-23 23:16:41
0
12KB
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
Do Men and Women Earn the Same Salary?
Do Men and Women Earn the Same Salary?
The question of whether men and women earn the same...
Business Automation in 2024: Top Five Trends
Business Automation in 2024: Top Five Trends
Business automation is often...
Dice
Dice are a popular source of randomness in board games (especially the game of the same name)....
How Often Should I Review My Financial Plan?
How Often Should I Review My Financial Plan?
How Often Should I Meet with My Adviser, and When...
How to Run a Successful Business in Today's Environment
How to Run a Successful Business in Today's Environment
In a fast-paced market and increasing...