Regular expressionsMeta-character quantifier (?)Metacharacters:.\w \d \s \w \d \s\ t \ \b() |[] [^]^ $Quantifiers:* + ?{n}, {n,}, {n,m}Re moduleHow to invoke the RE moduleFind: FindAll search match FinditerSplit and replace: Split Sub SubnCompile: Compile Save timeHow many places is the RE module used in?Quantifier: Indicates a match 0 or 1 timesAfter the quantifier: is the sign of the lazy matchGroup naming: (? pFindall/split Ungroup Priority: (?: Regular expression)
First, create a collection1. Featuresto store different elementsDisorderedImmutable types (numbers, strings, tuples)2. Create a CollectionS=set (' Hello ')Print (s)S=set ([' Alex ', ' Alex ', ' SB '])Print (s)s={1,2,3,4,5,6}3. Basic usage of sets(1) AddS.add (' s ')(2) ClearS.clear ()(3) CopyS.copy ()(4) DeleteRemove () Specifies to delete an element if the delete element does not exist then an errorDiscard (' sbbbb ') delete element not present no er
NodeListThe NodeList instance object is a class array object whose members are node objects, including the ChildNodes and Queryselectorall () method return valuesA dynamic collection is a change in the DOM structure that can be automatically reflected in the saved objectStaticNote NodeList are not all dynamic collections, where the Queryselectorall () return value is a static collection nodestaticlistArraySince nodelist is a class array object and not
The use of Java collection classes can be said to be ubiquitous, the total we can be divided into three chunks, respectively, from the collection interface extension of the list, set and the form of key-value pairs to store the map type collection. Many situations require that we iterate through the elements in the collection and do the appropriate processing. The following is a summary of the traversal of various types of collections, with regard to
1. Counter (counter)Counter is a dictionary method used to track the number of occurrences of a value, with all the functions and functions of a dictionary.>>> fromCollectionsImportCounter>>> D2 =Count>>> D2 = Counter ('abbcccddd')#Count of Values>>>Print(D2) Counter ({'D': 3,'C': 3,'b': 2,'a': 1})>>>Print(Type (D2))class 'collections. Counter'>>>> D2 = Counter ('abbcccddd')>>> forIinchD2.elements ():#count Element iterator...Print(i) ... bbadddccc>>>
Ever since JDK 1.2 collections are being widely used to store data in our programs. These Collection classes are used to store data which are shared by diferrent threads. Hence come the problem of which collection are. i.e. Operations on these collection classes are synchronized.If a collection class is isn't thread-safe and if we intend to use it in our multithreaded program, then we need to explicit Ely synchronize them. (or apply a wrapper class)So
Since collections are a tool that we often use, a collection library is essential and should be easily reused. In this way, we can easily take various collections and insert them into our programs. Java provides such a library, although it appears to be very limited in Java 1.0 and 1.1 (the Java 1.2 Collection library is undoubtedly a masterpiece).
1. Next-tracing modelling and template/versatilityTo make
1. Using a stream to traverse a collectionBrief introduction:Java's collection framework, such as the list and map interfaces and the ArrayList and HashMap classes, makes it easy to manage both ordered and unordered collections. The collection framework has been continuously improved since the first day of introduction. In Java SE 8, we can manage, traverse, and aggregate collections through the flow's API.
. 1. java. util. collection is
Set Interface. It provides common interface methods for basic operations on collection objects. The collection interface has many specific implementations in the Java class library. The collection interface provides a unified operation mode to maximize various specific sets. Collection
Shortlist
│ Invalid parameter list
│ ├ Arraylist
│ Vector
│ Elastic Stack
Collections set 2 and Java. util.
The difference between the two:Both are interfaces;Collectoin is a top-level interface of the Java Collection framework, and the stored elements can be any type of object;Map is a map interface of the Java collection framework that stores objects in the form of key-value pairs;That is, the element stored in collection is an object, and map is the stored element that is a pair of pair of key-value pairs.CollectionMapC.add ("Hello");C.add ("World");Map.put (1, "Beijing");Map.put (2, "tianjing");Co
Collection is the ancestor interface of the collection class, and the main interface for inheriting it is set and list.Collections is a helper class for a collection class that provides a series of static methods for searching, sorting, threading, and so on for various collections.Collections This class consists entirely of static methods that operate on collection or return collectionCollection is a collection interface, collections is a wrapper clas
Java-collection framework Collections. sort (), Comparable interface, and Comparator interface, javasortcomparator
Collentions tool class -- java. util. Collections
Collentions is a tool class used to operate collection objects in the Java Collection framework. It is also a member of the Java Collection framework and is in parallel with List, Map, and Set.
Collection
1.3.5 Ordereddict ordered DictionaryOrdereddict is a subclass of Dict, which remembers the order in which content is added.Import Collectionsprint ' Regular dictionary: 'D = {}D[' a '] = ' a 'D[' b '] = ' B 'D[' c '] = ' C 'For K, V in D.items ():Print K, Vprint ' \nordereddict: 'D = Collections. Ordereddict ()D[' a '] = ' a 'D[' b '] = ' B 'D[' c '] = ' C 'For K, V in D.items ():Print K, VExecution Result:#./collections_ordereddict_iter.pyRegular Dic
One, counter (counter)Counter is a supplement to the dictionary type that is used to track the number of occurrences of a value, which integrates all the functions of the parent class Dict.ImportCollectionsobj= Collections. Counter ('aaabbbcccddd')#counter class under the collections filePrint(obj)#return in dictionary formret= Obj.most_common (4)Print(ret)#the top 4 most
Hierarchical relationship between java Collection interface and Collections Class, Class Diagram
First, let's take a look at the difference between Collection and Collections. Collection and Collections are two completely different concepts. Collections is a java. util class that contains various static methods related
collection object also supports mathematical operations such as Union (union), intersection (intersection), Difference (poor), and sysmmetric difference (symmetric difference sets). Because the collection is unordered, the sets does not support indexing, sharding, or other class sequence (sequence-like) operation.The collection also has immutable forms, frozenset are fixed sets.#定义一个集合Set1 = {1,2,3,4,5}# or use the Set functionList1 = [6,7,7,8,8,9]Set2 =Set(List1)Set2.add (Ten)# Add new element
Collections is a python built-in collection module that provides a number of useful collection classes.Here are a few ways to do this:NamedtupleCounter ()DequeOrdereddictFirst, Namedtuplenamedtupleis a function that creates a custom object and specifies the tuple tuple number of elements that can be referenced by an attribute instead of an index tuple .Because the tuple is immutable, the object 's properties cannot be changed after the initializatio
This article will learn about another Python built-in module, collections, for more information, see: Python Learning Guide
Collections is a python built-in collection module that provides a number of useful collection classes.NamedtupleWe know that we tuple can represent immutable collections, for example, the two-dimensional left side of a point can be rep
This article was reproduced from: http://www.cnblogs.com/skywang12345/p/3308498.htmlthe Java collection can be divided into 4 parts: list lists, set sets, map mappings, tool classes (iterator Iterators, enumeration enumeration classes, arrays, and collections).General Description:First grab its trunk, collection and map.1 collection is an interface that is a highly abstracted collection that contains the basic operations and properties of a collection
Deque is an abbreviation for double-ended queue, similar to list, but provides an action to insert and delete at both ends.
Appendleft inserts to the left of the list
Popleft the value on the left side of the pop-up list
Extendleft extension on the left
For example:
Queue = Deque ()
# append values to wait for processing
queue.appendleft ("a")
Queue.appendleft ("second"
Queue.appendleft ("third")
# Pop values when ready
process (Queue.pop ()) # would process "a"
# add V
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.