Remove Keys from Dictionary - Python

0
12K

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. 

Site içinde arama yapın
Kategoriler
Read More
Programming
Python Steam API
python-steam-api is a Python library wrapper for the web API Steam. It provides many functions...
By Jesse Thomas 2023-04-21 19:56:56 0 12K
Жизненные вопросы
Во имя отца. In the Name of the Father. (1993)
Эта драма основана на реальных событиях - истории «Гилфордской четверки». В 1975 году...
By Nikolai Pokryshkin 2023-03-27 12:21:56 0 32K
Trains and Railroads
Unusual railways of the world
Such a familiar thing for us - the railway! One of the most reliable (safe), affordable...
By FWhoop Xelqua 2022-11-18 12:58:56 0 25K
Social Issues
The Intern. (2015)
Seventy-year-old widower Ben Whittaker has discovered that retirement isn't all it's cracked up...
By Leonard Pokrovski 2023-05-25 18:58:50 0 25K
Business
What Are the Typical Deliverables of a Business Consulting Project?
Business consulting projects are designed to address specific challenges, improve efficiency, and...
By Dacey Rankins 2025-02-10 18:25:29 0 13K

BigMoney.VIP Powered by Hosting Pokrov