The content is edited by the XUE.cn content team through official documents. I hope it will be helpful to python beginners, newcomers who want to have a more comprehensive grasp of python basics, and other python enthusiasts as a quick reference book.
It is strongly recommended to open the "Python Basic Knowledge Point Self- Test Manual" on XUE.cn to study or consult: you can use your mobile phone, tablet, or computer without any configuration to write code, modify the code in the book, and run the verification code anytime and anywhere.
To register, please use my invitation code: https://xue.cn?inviter=xxmbz Both you and I can get 2 days of study time, thank you!
This book basically sorts out the basic knowledge points, basic concepts and connections of Python in a comprehensive and complete way, and opens up the "two pulses of Ren and Du" for Python to continue to diligently. In practice and application, you can check quickly, do whatever you want, and come at your fingertips. Mastering the basics will make further learning Python more handy.
-
Number
1.1. ⚫ Overview of number types
1.2. ⚫ Integers and bit operations
1.3. ⚫ Boolean values and Boolean operations
1.4. ⚫ Floating-point numbers
1.5. ⚫ Complex numbers
1.6. ⚫ Number operations -
String
2.1. ⚫ String overview
2.2. ⚫ String splicing
2.3. ⚫ Escape character
2.4. ⚫ Str.count statistics
2.5. ⚫ str.replace replaces
2.6. ⚫ str.expandtabs replaces tabs
2.7. ⚫ str.split Split
2.8. ⚫ str.rsplit split
2.9. ⚫ str.partition split
2.10. ⚫ str.rpartition split
2.11. ⚫ str.splitlines split by line
2.12. ⚫ str.strip removes both sides of the character
2.13. ⚫ str .lstrip removes the left character
2.14. ⚫ str.rstrip removes the right character
2.15. ⚫ str.find finds the minimum index
2.16. ⚫ str.rfind finds the maximum index
2.17
. ⚫ str.index finds the minimum index 2.18. ⚫ str.rindex finds The maximum index is
2.19. ⚫ str.join concatenate string
2.20. ⚫ str.startswith specifies the beginning of the string?
2.21. ⚫ str.endswith specifies the end of the string?
2.22. ⚫ str.ljust left justify
2.23. ⚫ str.center centered
2.24. ⚫ str.rjust right justified
2.25. ⚫ str.format format
2.26. ⚫ str.format_map format
2.27. ⚫ f-string format string
2.28. ⚫ String operator
2.29. ⚫ str.encode is encoded as a byte string
2.30. ⚫ str.capitalize Capitalize the first character
2.31. ⚫ str.casefold eliminate case
2.32. ⚫ str.lower to lowercase
2.33. ⚫ str.title to capitalize the first letter of a word
2.34. ⚫ str.upper to uppercase
2.35. ⚫ str.swapcase to convert between uppercase and lowercase
2.36. ⚫ str.zfill fills with 0
2.37. ⚫ str.translate converts according to table
2.38. ⚫ str.maketrans generates conversion table
2.39. ⚫ Is str.isalnum a letter or a number?
2.40. ⚫ Is str.isalpha a letter (including Chinese characters, etc.)?
2.41. ⚫ Is str.isdecimal a decimal character?
2.42. ⚫ Is str.isdigit a number?
2.43. ⚫ Is str.isnumeric a numeric character?
2.44. ⚫ Is str.islower lowercase?
2.45. ⚫ Is str.isupper uppercase?
2.46. ⚫ str.istitle is the title string?
2.47. ⚫ Is str.isascii an ASCII character?
2.48. ⚫ Is str.isidentifier a valid identifier?
2.49. ⚫ Is str.isprintable a printable character?
2.50. ⚫ Is str.isspace a blank character?
2.51. ⚫ str.removeprefix removes prefix
2.52. ⚫ str.removesuffix removes suffix -
List
3.1. ⚫ List overview
3.2. ⚫ List comprehension
3.3. ⚫ List index and slicing
3.4. ⚫ List operator
3.5. ⚫ List.append adds an element
3.6. ⚫ list.extend adds an element in the iterable object
3.7. ⚫ list.insert inserts an element
3.8. ⚫ list.sort sorts the list in place
3.9. ⚫ list.reverse reverses the elements in the list
3.10. ⚫ list.pop deletes an element and returns
3.11. ⚫ list.remove removes an element
3.12. ⚫ list.count counts the number of occurrences of elements
3.13. ⚫ list.index finds the smallest index
3.14. ⚫ list.copy a shallow copy of the list
3.15. ⚫ list.clear deletes all elements -
Tuple
4.1. ⚫ Overview of tuples
4.2. ⚫ tuple.count counts the number of occurrences of elements
4.3. ⚫ tuple.index finds element index
4.4. ⚫ Tuple operator -
Sequence and general operations
5.1. ⚫ Overview of sequence types
5.2. ⚫ Range objects
5.3. ⚫ Sequence index and slice
5.4. ⚫ Sequence general operations -
Set
6.1. ⚫ Overview of set
6.2. ⚫ set.isdisjoint Is the intersection empty?
6.3. ⚫ Is set.issubset a subset?
6.4. ⚫ Is set.issuperset a superset?
6.5. ⚫ set.union union
6.6. ⚫ set.intersection intersection
6.7. ⚫ set.difference difference set
6.8. ⚫ set.symmetric_difference symmetric difference
6.9. ⚫ set.copy shallow copy
6.10. ⚫ set.update merge update
6.11. ⚫ set.intersection_update Intersection update
6.12. ⚫ set.difference_update Difference update
6.13. ⚫ set ^= other Symmetric difference update
6.14. ⚫ set.add add element
6.15. ⚫ set.remove delete element
6.16. ⚫ set.discard delete element
6.17 . ⚫ set.pop deletes the element and returns
6.18. ⚫ set.clear clears the collection element -
Dictionary
7.1. ⚫ Dictionary overview
7.2. ⚫ dict.keys key view
7.3. ⚫ dict.values value view
7.4. ⚫ dict.items key-value pair view
7.5. ⚫ dict.get Get the value of a key
7.6. ⚫ dict.copy Shallow copy
7.7. ⚫ dict.pop deletes elements and returns value
7.8. ⚫ dict.popitem deletes elements and returns key-value pair
7.9. ⚫ dict.fromkeys creates dictionary
7.10. ⚫ dict.clear clears dictionary elements
7.11. ⚫ dict.setdefault gets Or insert element
7.12. ⚫ dict.update Update dictionary
7.13. ⚫ Dictionary traversal
7.14. ⚫ Dictionary operator -
Other built-in types
8.1. ⚫ Null value None
8.2. ⚫ Generator expressions and derivations
8.3. ⚫ Other built-in types -
Operators
9.1. ⚫ Overview of operators
9.2. ⚫ Comparison operators
9.3. ⚫ Operator precedence
9.4. ⚫ Special use of operators -
Statement
10.1. ⚫ Expression statement
10.2. ⚫ Assignment statement
10.3. ⚫ If condition judgment
10.4. ⚫ for loop
10.5. ⚫ while loop
10.6. ⚫ break statement
10.7. ⚫ continue statement
10.8. ⚫ del statement
10.9. ⚫ pass statement
10.10. ⚫ def defines function
10.11. ⚫ return statement
10.12. ⚫ yield statement
10.13. ⚫ class defines class
10.14. ⚫ try statement
10.15. ⚫ raise statement
10.16 . ⚫ global with statement
10.17. ⚫ assert statement
10.18. import ⚫ assert statement 10.18. ⚫
Statement
10.20. ⚫ Nonlocal statement -
Built-in function
11.1. ⚫ abs() takes the absolute value of the number
11.2. ⚫ all() is the boolean value of all elements true?
11.3. ⚫ Does any() have an element boolean value true?
11.4. ⚫ ascii() returns the printable string of the object
11.5. ⚫ bin() the binary form of the integer
11.6. ⚫ bool returns the boolean value of the object
11.7. ⚫ bytes creates the bytes object
11.8. ⚫ Is callable() a callable object?
11.9. ⚫ chr() returns the character corresponding to the Unicode code point value
11.10. ⚫ classmethod wrapper function is class method
11.11. ⚫ compile() creates code object
11.12. ⚫ complex creates complex number
11.13. ⚫ delattr() deletes object attributes
11.14. ⚫ dict Create a dictionary
11.15. ⚫ dir() returns a list of object attributes
11.16. ⚫ divmod() finds the quotient and remainder of two numbers
11.17. ⚫ enumerate enumerates
11.18. ⚫ eval() parses a string or code and evaluates
11.19. ⚫ exec () Parse string or code and evaluate
11.20. ⚫ filter Truth element filtering
11.21. ⚫ float Create floating-point number
11.22. ⚫ format() Format
11.23. ⚫ frozenset creates an immutable set
11.24. ⚫ getattr() gets the attributes of an object 11.23. ⚫
globals() returns a dictionary of global variables
11.26. ⚫ is hasattr() an attribute of the object?
11.27. ⚫ hash() returns the hash value of the object
11.28. ⚫ help starts the help system
11.29. ⚫ hex() the hexadecimal form of the integer
11.30. ⚫ id() returns the unique identifier of the object
11.31. ⚫ input() accepts The input returns the string
11.32. ⚫ int creates the integer
11.33. ⚫ isinstance() is an instance of the given class?
11.34. ⚫ Issubclass() is a subclass of a given class?
11.35. ⚫ iter() to iterator
11.36. ⚫ len() returns the number of elements
11.37. ⚫ list creates a list
11.38. ⚫ locals() returns a dictionary of local variables
11.39. ⚫ map transforms elements with a given function
11.40. ⚫ max () Find the largest item
11.41. ⚫ min() Find the smallest item
11.42. ⚫ next() returns the next element of the iterator
11.43. ⚫ object The base class of all classes
11.44. ⚫ oct() The octal form of an integer
11.45. ⚫ open( ) open a file
11.46. ⚫ ord() returns the Unicode code point value of a single character
11.47. ⚫ pow() exponentiates and takes the remainder
11.48. ⚫ print() prints the object
11.49. ⚫ property returns the property property
11.50. ⚫ range creates the range sequence
11.51. ⚫ repr () Returns the printable string of the object
11.52. ⚫ reversed the reversed sequence
11.53. ⚫ round() rounds numbers
11.54. ⚫ set creates a collection
11.55. ⚫ setattr() sets or adds attributes
11.56. ⚫ slice creates a slice object
11.57 . ⚫ sorted() returns a sorted list
11.58. ⚫ The staticmethod wrapper function is a static method
11.59. ⚫ str creates a string
11.60. ⚫ sum() number sum or sequence splicing
11.61. ⚫ super call is delegated to the parent or sibling
11.62. ⚫ tuple creates tuple
11.63. ⚫ type judges the type or creates class
11.64. ⚫ vars() returns the variable dictionary of the object
11.65. ⚫ zip reorganizes iterable object -
Function
12.1. ⚫ Function overview
12.2. ⚫ Function definition
12.3. ⚫ Function parameter
12.4. ⚫ Function return value
12.5. ⚫ Recursive function
12.6. ⚫ Function documentation
12.7. ⚫ Function call
12.8. ⚫ Lambda function
12.9. ⚫ Generator function -
Errors and exceptions
13.1. ⚫ Overview of errors and exceptions
13.2. ⚫ Handling exceptions
13.3. ⚫ Throwing exceptions
13.4. ⚫ Custom exceptions
13.5. ⚫ Finally cleanup operations -
File operations
14.1. ⚫ Overview of file objects
14.2. ⚫ Read file contents
14.3. ⚫ File write contents -
Module
15.1. ⚫ Module overview
15.2. ⚫ Create module
15.3. ⚫ Executable file
15.4. ⚫ Import operation -
Object-oriented
16.1. ⚫ Object-oriented overview
16.2. ⚫ Class definition
16.3. ⚫ Example
16.4. ⚫ Object
16.5. ⚫ Name
16.6. ⚫ Variable
16.7. ⚫ Property
16.8. ⚫ Method
16.9. ⚫ Namespace
16.10. ⚫ Scope
16.11. ⚫ Create instance
16.12. ⚫ Property operation
16.13. ⚫ Method operation
16.14. ⚫ Class inheritance