List type built-in method
List Properties
Stored value or a plurality of values: a plurality of values
Ordered or disordered: Ordered
Variable or immutable: Variable Data Type
Priority grasp
By index value (positive value + antiporter value), may be taken to deposit
list[0]='a'
slice
list[start:stop:step]
Length len
len ( list )
Members and not in operation in
'a' in 'abc' ==》True
'a' not in 'abc'==》False
Add append
lis.append(object)
Delete del
the lis
cycle
for i in lis:
print i
Need to know
insert insert
lis.insert(index,object)
pop pop
lis.pop(index)
index may be empty, the default value is the last pop
remove remove (not being given)
lis.remove(object)
count the number
lis.count(object)
Gets the index index
lis.index(object,start,stop)
clear Clear Array
lis.clear
copy replication (different id)
lis.copy()
extend extension
lis.extend(iterable)
reverse reverse
lis.resverse()
sort sort
lis.sort(key,reverse)
Tuple built-in method
Tuple property
Is the immutable list
Is defined: a = (); a = tuple ()
Stored value or a plurality of values: a plurality of values
Ordered or disordered: Ordered
Variable or non-variable: immutable data type
Built-in method
Priority grasp
Index values
Sections (care regardless of the end, step)
Length len
Members and not in operation in
cycle
count
index
Use reference list
Dictionary built-in method
Dictionary property
Stored value or a plurality of values: a plurality of values
Ordered or disordered: disordered
Variable or immutable: Variable Data Type
Built-in method
Priority grasp
Access key press value: deposit may be desirable
Length len
Members and not in operation in
Delete del
Button keys (), the value of values (), on the key-value items ()
dic.keys()
dic.values()
dic.items()
(Loop is withdrawn key)
Need to know
get Gets
dic.get(key)
update update
dic.update ( {} key-value pair )
fromkeys quickly create a dictionary
dict.fromkeys([keys],value)
setdefault setting default values
dic.setdefault(key,default)
A collection of built-in method
Stored value or a plurality of values: a plurality of values, the data type is immutable
Ordered or disordered: disordered
Variable or immutable: Variable Data Type
Built-in method
Priority grasp
Length len
Members and not in operation in
| Union, union
& Intersection, intersection
-差集、difference
^ Symmetric difference, symmetric_difference
==
Parent Set:>,> =, issuperset
Subsets: <, <=, issubset
Need to know
- add
- remove
- difference_update
- discard
- isdisjoint