1.python inside %d Table number ,%s Represents a string ,%% Represents a %;
2. Single quotation marks embedded in single quotation marks need escape characters /; Nested double quotation marks inside single quotation marks do not need to be nested ;
Double quotes nested double quotes need escape character /; Double quotation marks refer to single quotation marks without escape character .
3. String compilation process :gbk==>unicode==>utf16==>url decode
The decoding order of strings is :url decode ==>utf16==>unicode==>gbk
4. Variable data type : list [], Dictionaries {}, aggregate
Immutable data type : plastic int, character string str‘’, tuple ()
5.list-[ ]
tuple-( )
dict,set,frozenset-{ }
6.read() Read and write the whole file readline() Read only write one line readlines() All right list
7.Python use # Used to annotate , Block statements by indenting . ,
8.Python The sequence types for include lists , tuple , Dictionaries , among , The dictionary is Pyhton The only mapping type in .
9.Python The number types of include numbers , character string , list , tuple , aggregate , Dictionaries .
10.b binary mode
r read-only , The pointer is placed at the beginning of the file
rb Binary read only , The pointer is placed at the beginning of the file
r+ Reading and writing , The pointer will be placed at the beginning of the file
w write in ,~
wb Binary write ~
w+ Reading and writing ~
wb+ Binary read write ~
a Add ~
ab Binary addition ~
a+ Reading and writing ~
ab+ Binary read write ~
11. The plural cannot be compared in size ,ASCll Small letters in the code > capital > number
12.Python Explain the voice of the execution ,JAVA,objectC,C# It's a class C language .
13. The key value of the dictionary must be an immutable type .
14.dict() Used to create a dictionary .
15.Python Multiple statements can be displayed on the same line , The method is to use a semicolon ; separate .
15. Identifiers that begin with an underline have a special meaning . Start with a single underline _foo Represents a class property that cannot be accessed directly , It needs to be accessed through the interface provided by the class , out-of-service from xxx
import * And import .
16. The data in the dictionary is accessed by keys , The list data is accessed by offset . A list is an ordered collection of objects , A dictionary is an unordered collection of objects .
17. List can complete the data structure implementation of most collection classes . It supports characters , number , Strings can even contain lists ( That is 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 memory space );== Used to determine whether the values of two variables are equal .
20.Python Variable naming rules based on ?
① Variable names can only contain letters , Numbers and underscores . Variable names can start with letters or underscores , But it can't start with a number , for example , The variable can be named message_1, But you can't name it 1_message.
② Variable names cannot contain spaces , But you can use underscores to separate the words . for example , Variable name greeting_message feasible , But the variable name greeting message Can cause errors .
③ Don't put Python Keywords and function names are used as variable names , That is, do not use Python Words reserved for special purposes , as print.

Variable names should be short and descriptive . for example ,name than n good ,student_name than s_n good ,name_length than length_of_persons_name good .
⑤ Use small letters carefully l And capital letters O, They may be mistaken for numbers 1 and 0.
21. sketch Python Deep and shallow copy and application scenarios of ?
The use of deep and shallow copy comes from copy modular .

Import module :import copy

Shallow copy :copy.copy

Deep copy :copy.deepcopy

about number and character string for , assignment , Shallow copy and deep copy are meaningless , Because it always points to the same memory address .

Shallow copy refers to copying only the first layer of data set , Deep copy refers to copying all layers of a data set . So for a data set with only one layer, the meaning of deep and shallow copy is the same , Like strings , number , There is only one level of dictionary , list , Yuanzu et al .

Deep copy python Create a new copy of all data in memory , So if you modify the new template, the old template will not change .
22. Brief introduction to use requests Module for data crawling process ?
(1) appoint url
(2) be based on requests Module initiate request
(3) Gets the data in the response object
(4) Data analysis
(5) Persistent storage

Technology