In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly talks about "what are the python combination data types". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the python combination data types"?
Combinatorial data types are classified into three categories, the first is set types, the second is sequence types, and the third is mapping types. the collection type is a collection of elements and there is no order between elements. without the definition of the same element collection type, the collection type is defined by braces {}, elements are separated by commas, and elements must be immutable constants. For example, numbers and so on. Regardless of whether the elements coincide with each other when the collection is defined, only one of the same elements is automatically removed when the collection is output. Some operations of the collection type
Operation between collection and collection
The elements in this set are S set after removing the same elements of S and T set. S | T means to return a set. The elements in this set are S set and T set. The total element S ^ T means to return a set. The elements in this set are the set of elements that the S set and the T set do not have in common. The S set represents a set that returns a collection. The elements in this set are the elements shared by the S set and the T set.
Some operation functions and methods of set
S.add (x) if data x is not in the collection, add data x to S collection S.remove (x) if data x is in set S, delete data x, if data x is not in collection, generate KeyError exception S.clear () remove all elements in set S len (S) return the number of elements in set x in S if x is in set S return True Otherwise, return Falsex not in S if x is not in set S, return True, otherwise return Falseset () to create an empty collection, the set (x) function changes other combination types into set types, and the return result is a non-repetitive and unsorted collection sequence. The common ones in the sequence collection are strings and list tuples, the elements of the sequence collection can be repeated and ordered, and you can use the index to find the corresponding elements. The index starts at 0, which means that the index of the first element is 0. Mapping set mapping collection is the most common dictionary, through key-value pairs to find elements (later notes will be described in detail when writing to the dictionary) so far, I believe that we have a deeper understanding of the "python combination data types", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.