One General containers support The operation of is called public operation , Include Operator , Public methods and Container type conversion etc. .
+: Merge function ( Dictionary not supported )
*: Replication effect
2.1 len():
2.2del()
2.3 max()
2.4min()
2.5 range(): Generated from start Start to end end , Compensation for step Can be cut
range()⽣ The generated sequence does not contain end Numbers . If you don't write the beginning , The default from the 0 Start . If you don't write the step size , The default is 1.
2.6 enumerate()
The return is Tuples , The first data of the tuple is the subscript corresponding to the iteration object data , The second data is the data of the original iteration object .
enumerate( Traversable objects ,start=0)
#start Parameter is used to set the subscript starting value of traversal data , The default is 0
list1 = ['a', 'b', 'c', 'd', 'e']
for i in enumerate(list1):
print(i)
for index, char in enumerate(list1,start=1):
print(f' The subscript is {
index}, The corresponding character is {
char}')
tuple(): Convert a sequence to a tuple
list(): Convert a sequence to a list
set(): Convert a sequence into a set
Quickly complete the list de duplication + Subscripts are not supported
effect : Simplify the code
effect : Create a with an expression Regular pattern Or control a regular list ( List generator )
# Create a 0-10 A list of
list1=[]
i=0
while i<10:
list1.append(i)
i+=1
print(list1)
list1=[]
for i in range(10):# The default from the 0 Start , In steps of 1
list1.append(i)
# Implementation of list derivation
list1=[i for i in range(10)]
print(list1)
# first i It refers to the return value of the list , the second i refer to 0-9
# belt if List expressions for
list1 = [i for i in range(0, 10, 2)]
print(list1)
list1 = [i for i in range(10) if i % 2 == 0]
print(list1)
Multiple for Loop to implement the list derivation :
list1=[]
for i in range(1,3)
for j in range(3)
list.append(i,j)
list1 = [(i, j) for i in range(1, 3) for
j in range(3)]
print(list1)
The function of dictionary derivation : Quickly merge lists into dictionaries or extract from dictionaries ⽬ Bid data .
Committed to quantitative stra
項目介紹論文闡述了圖書管理系統,並對該系統的需求分析及系統需