In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Clear () delete dictionary key-value pair: clear everything in the dictionary, but do not delete the dictionary itself, del delete dictionary itself dict4 = {'name':' Tom', 'age': 18} dict4.clear () print (dict4)
Return: {}
Dict (dictionary) in python:
1. The dictionary is another variable container model, in which each key-value pair is separated by a colon (:), each key-value pair is separated by a comma (,), and the whole dictionary is surrounded by curly braces {}
two。 The key in the dictionary is generally unique. If repeated, the following key-value pair will overwrite the previous one, but the dictionary value does not need to be unique.
3. The value can take any data type, but the key must be an immutable type, such as a string, number, or tuple, but not a list because the list is mutable.
The above is all the content of the article "how python uses clear () to delete dictionary key-value pairs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.