`# ----- Shallow and deep copies`
``` 1 import copy
2
3 a = ["xiaoming",111,[5000,2000]]
4 b = a
5 print("b:%s" % b) #a,b Sharing the same memory address,Output result b:['xiaoming', 111, [5000, 2000]]
6
7 #Shallow copy only copy the first layer,Layer 2 pointer to share[5000,2000]
8 c = a.copy() #Shallow copy
9 c[0] = "xiaowang"
10 c[1] = 222
11 a[2][1] -= 300
12 print("c:%s" % c) #c:['xiaowang', 222, [5000, 1700]]
13
14 d = copy.copy(a)  #Shallow copy
15 d[0] = "xiaoyang"
16 d[1] = 333
17 d[2][1] -= 700
18 print("d:%s"% d) #d:['xiaoyang', 333, [5000, 1000]]
19
20 #Deep copy, clone the same copy
21 e = copy.deepcopy(a) #Deep copy
22 e[2][1] += 1000
23 print("e:%s" % e) #e:['xiaoming', 111, [5000, 2000]]```
`# Sets`
`#Sets combine different elements together`
```1 a = set("python project")
2 print(a) #{'c', ' ', 'p', 'e', 'h', 'j', 'y', 'o', 't', 'r', 'n'}
3 b = set(["python","linux","java","linux"])
4 print(b,type(b)) #{'python', 'java', 'linux'} <class 'set'>  #set remove weights
5 print(list(b)) #['java', 'linux', 'python'] #Turn to list```
`# Collection objects are a set of disorderly hash values that members of a collection can use as keys in a dictionary.`
```1 li = [[1,2],'a','b']
2 s = set(li)
3 print(s) #TypeError: unhashable type: 'list'
4
5 a = [1,2,"a","z"]
6 b = set(a)
7 c = {"info":b}
8 print(c) #{'info': {'a', 1, 2, 'z'}}```
`# Set Classification: Variable Set and Invariable Set# Variable Sets: Elements can be added and deleted. Sets are non-hashable and cannot be used as dictionary keys or elements of other collections.# Frozenset cannot be added or deleted`
`# Create collections`
```1 a1 = set(("test","hello"))
2 print(a1) #{'test', 'hello'}```
`# Access Collection`
```1 #-----in,not in Determine whether or not in a set
2 a2  = set(["dream","rise",1,2,4])
3 print("dream" in a2) #True
4 print("rise" not in a2) #False```
`# for loop traversal`
```1 for i in a2:
2     print(i)```
`# Adding, modifying, and deleting elements in a collection`
``` 1 #-----add Add to
3 print(a2) #{1, 2, 'uu', 4, 'dream', 'rise'}
4
5 #-----update To update
6 a2.update("abs")
7 print(a2) #{1, 2, 4, 'dream', 'a', 'rise', 'uu', 's', 'b'}
8
9 a3 = {1, 2, 4, 'dream', 'rise'}
10 a3.update([12,"hello",1])
11 print(a3) #{1, 2, 'hello', 4, 12, 'rise', 'dream'}
12
13 #-----delete
14 a3.remove(1)
15 print(a3) #{'dream', 2, 4, 12, 'hello', 'rise'}
16
17 a3.pop() #Random deletion
18 print(a3) #{4, 12, 'dream', 'rise', 'hello'}
19
20 a3.clear() #Empty collection
21 print(a3)
22
23 del a2 #Delete set
24 print(a2)```
`# Collection operations`
``` 1 #Set Equivalence to Non-Equivalence
2 print(set("test") == set("tesssssttt")) #equivalence  #True
3 print(set("test")!= set("tesssssttt"))
4
5 a = set([1,2,3,4,5,6,7])
6 b = set([3,4,5,6,7,8,9])
7
8 print(a & b) #intersection{3, 4, 5, 6, 7}
9 print(a | b) #Union{1, 2, 3, 4, 5, 6, 7, 8, 9}
10 print(a - b) #Difference set{1, 2}
11 print(b - a) #Difference set{8, 9}
12 print(a ^ b) #Symmetric difference sets{1, 2, 8, 9}
13
14 #-----Subsets, Supersets (Parents)
15 print(a > b)
16 print(a < b)```
`# Function`
`# - Function:    1. Reduce duplicate code    2. Convenient modification    3. Keeping Code Consistency# - Naming rules for functions:    1. Function names must begin with underscores or letters, and may contain any combination of letters, numbers or underscores.    2. Cannot use any punctuation marks    3. Function names are case-sensitive    4. Function names cannot be reserved words# - Formal and practical parameters    Formal parameters: Formal parameters, not actual, are virtual variables.    Parameters: actual parameters, parameters passed to the function in electrophoresis.`
`# logging module`
``` 1 import logging
2
3 logger = logging.getLogger() #Establish logger object
4
5 fh = logging.FileHandler('test.log') #Create a file output object
6
7 sh = logging.StreamHandler() #Creating Screen Output Objects
8
9 formater = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
10
11 fh.setFormatter(formater)
12 sh.setFormatter(formater)
13
`# logging Screen Output, File Writing Log Information`
```1 2019-09-24 16:48:27,485 - root - WARNING - warning message3