Remove Keys from Dictionary - Python
Postado 2023-02-23 23:16:41
0
6KB
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
For a Few Dollars More. (1965)
Two bounty hunters with the same intentions team up to track down an escaped Mexican outlaw....
Navigating the World's Arteries: A Comprehensive Look at Roads and Highways
Roads and highways are the lifelines of modern civilization, weaving through landscapes,...
What Should I Look for When Hiring a Business Consultant?
Hiring a business consultant can be one of the best decisions a company makes, especially when...
How AI is Impacting Entrepreneurship
In recent years, Artificial Intelligence (AI) has emerged as a game-changing technology,...
The Lion King. (1994)
A young lion prince is cast out of his pride by his cruel uncle, who claims he killed his father....