[Reading Notes] Python basics and python Basics
Basic Python tutorial
-
- Basic Python tutorial
- Chapter 1 Basic Knowledge
- Chapter 2 list and tuples
- Chapter 3 Use strings
- Chapter 4 dictionaries when the index is poor
- Chapter 6 conditional loops and other statements
Chapter 1 Basic Knowledge
Chapter 2 list and tuples
Chapter 3 Use strings
Chapter 4 dictionaries when the index is poor
Chapter 6 conditional loops and other statements
B. Number iteration, enumerate function, which can iterate the index-value pair where the index is provided.
Eg: for index, string in enumerate (strings ):
If 'xxx' in string:
String [index] = '[censored]'
C. Flip iteration and reversed functions. If they are not modified in the same place, the iterated objects after flip are returned.
Eg: ". join (reversed ('hello, world! ') Get '! Dlrow, olleh'
D. Sort iteration, sorted function, without modifying in situ, return the sorted list.
17. Skip loop: break, continue, while True/break statement
18. List derivation, using other lists to create a new list
Eg: [x * x for x in range (10) if x % 3 = 0] x * x two conditions
[(X, y) for x in range (3) for y in range (3)]
19. The pass statement is used as a placeholder in the code.