%s represents a string, and %% represents a %; 2. The escape character/is required for nested single quotation marks. Double quotation marks do not need to be nested. Double quotes nested within double quotes require the escape character /; No escape characters are required to quote single quotes inside double quotes. 3. String compilation process: GBK ==> Unicode ==> UTF16 ==> URL Decoding sequence: URL decoding ==> UTF16 ==> Unicode ==> GBK 4 Mutable data types: list [], dictionary {}, set immutable data types: Integer int, string STR ‘ ‘, tuple () 5.list-[] tuple-() dict, set, frozenset-{} 6.read() reads and writes the entire file readline() reads and writes only one line readlines() to the list 7.Python uses # for comments to indent blocks of statements. 8.Python sequence types include lists, tuples, and dictionaries, of which dictionaries are the only mapping type in Pyhton. 9.Python’s number types include numbers, strings, lists, tuples, sets, and dictionaries. 10. B binary mode r read-only, pointer will be placed at the beginning of the file RB binary mode r+ read/write, pointer will be placed at the beginning of the file w write, ~ wb binary write to w+ Read/write to WB + Binary read/write to A Append to ab Binary append to a+ read/write to ab+ Binary read/write to 11. Numbers cannot be compared in size, ASCll code small letters > uppercase letters > numbers 12.Python to explain the execution of speech, JAVA, objectC, C# are C-like languages. 13. Dictionary keys must be immutable types. 14. Dict () is used to create a dictionary. 15.Python can display multiple statements on the same line using a semicolon; 15. Identifiers that begin with an underscore have special meaning. The attributes that start with a single underscore _foo are attributes that cannot be accessed directly. They must be accessed through the interface provided by the class and cannot be imported using from XXX import *. 16. Data in dictionaries is accessed by keys, while data in lists is accessed by offsets. Lists are ordered collections of objects, dictionaries are unordered collections of objects. 17. Lists can complete the data structure implementation of most collection classes. It supports characters, numbers, strings and even lists (i.e., nesting). 18. Hex () — Converts an integer to a hexadecimal string. Oct () — converts an integer to an octal string. 19. Is used to determine whether the reference object of two variables is the same (same block of memory space); == Is used to determine whether the values of two variables are equal. 20.Python variable naming rules? The variable name can contain only letters, digits, and underscores (_). Variable names can start with a letter or underscore, but not with a number. For example, you can name a variable message_1, but not 1_message. ② Variable names cannot contain Spaces, but can be separated by underscores. For example, the variable name greeting_message works, but the variable name greeting message raises an error. ③ Do not use Python keywords and function names as variable names, that is, do not use words that Python reserves for special purposes, such as print. ④ Variable names should be short and descriptive. For example, name is better than n, student_name is better than s_n, and name_length is better than length_OF_persons_name. Be careful with the lowercase letter L and uppercase letter O, as they may be mistaken for numbers 1 and 0. 21. Describe deep and light copies of Python and their application scenarios. The depth and light copy usage comes from the copy module.
Import modules: import copy
Shallow copy: copy. Copy
Deepcopy: copy. Deepcopy
Assignment, shallow copy, and deep copy are meaningless for numbers and strings because they always point to the same memory address.
Shallow copy refers to copying only the first layer of the data set, and deep copy refers to copying all layers of the data set. So deep and shallow copies have the same meaning for data sets with only one layer, such as strings, numbers, and dictionaries, lists, primitives, etc., with only one layer.
For deep copy, Python creates a new copy of all data in memory, so if you modify the new template, the old one does not change. 22. Describe the general flow of data crawling using the Requests module. (1) Specify urls, (2) initiate requests based on the Requests module, (3) retrieve data from the response object, (4) parse data, and (5) persist storage
Get more basic tutorials here