Remove Keys from Dictionary - Python

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. 

Поиск
Категории
Больше
Social Issues
The Apartment. (1960)
A Manhattan insurance clerk tries to rise in his company by letting its executives use his...
От Leonard Pokrovski 2023-01-19 21:55:39 0 22Кб
Business
What Motivates and Retains Employees Here?
Understanding what drives and keeps employees engaged in a company gives insight into its...
От Dacey Rankins 2025-08-09 18:31:13 0 11Кб
Business
What Questions Do Investors Commonly Ask Startup CEOs?
For startup CEOs, investor meetings are critical milestones. These conversations go beyond just...
От Dacey Rankins 2025-05-06 12:50:21 0 9Кб
Спорт
Бешеный бык. Raging Bull. (1980)
Джейк ЛаМотта, получивший прозвище Бронксский Бык, - боксер. И все его психологические и...
От Nikolai Pokryshkin 2023-03-01 13:57:11 0 34Кб
Television
ABS, Live TV. Antigua & Barbuda.
The face of local broadcasting in Antigua and Barbuda. ABS TV is an Internet only TV channel...
От Nikolai Pokryshkin 2022-11-13 16:44:20 0 39Кб

BigMoney.VIP Powered by Hosting Pokrov