Remove Keys from Dictionary - Python

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. 

Rechercher
Catégories
Lire la suite
Телевидение
Известия 78. ТВ он лайн.
Телевидение Петербурга. Новостные программы, благодаря которым вы оперативно получаете информацию...
Par Nikolai Pokryshkin 2022-10-19 20:49:02 0 28KB
Television
Fox 2 St. Louis. Live TV. USA.
TVI is a Fox-affiliated television station located in St. Louis, Missouri, United States. It...
Par Nikolai Pokryshkin 2022-10-16 09:45:21 0 34KB
Science Fiction and Fantasy
Aquaman. (2018)
Arthur Curry, the human-born heir to the underwater kingdom of Atlantis, goes on a quest to...
Par Leonard Pokrovski 2023-05-01 20:24:58 0 31KB
Financial Services
The effect of time on your retirement account
The effect of time on your retirement account When you’re young,...
Par Mark Lorenzo 2023-05-26 18:53:26 0 12KB
Marketing and Advertising
When Should I Launch a Product — and How Far in Advance Should I Prepare?
Timing can make or break a product launch. You could have a brilliant product, the perfect target...
Par Dacey Rankins 2025-10-29 15:10:27 0 5KB

BigMoney.VIP Powered by Hosting Pokrov