1) What is? Python? Use Python What are the benefits ?
Python Is an object , modular , Threads , Exception and automatic memory management programming language .
python It's a little simple , Easy to use , portable , Scalable , Built in data structure , And it's open source .
2) What is? PEP 8?
PEP 8 It's a coding convention , It's a set of suggestions , How to write content that is more readable Python Code .
3) What is? pickling and unpickling?
In order to allow users to save complex data types during normal programming and testing ,python Standard modules are provided , be called pickle. This module can convert almost any python Object is converted to a string representation , This process is called pickling. Instead, reconstruct the original object from the inside , It is called a unpickling. stay pickling and unpicking Between , The string representation of these objects , It can be saved in a file , It can also be transmitted between remote machines through the network .
4) How to understand Python It's interpreted language ?
Python Language is an interpretative language .Python The program runs directly from the source code . From source code to intermediate language , The intermediate language is translated into executable machine language .
5) How to be in Python Manage memory in ?
Python Memory by Python Private heap space management . all Python Objects and data structures are located in private heap space . Programmers cannot access this private heap space , The interpreter is responsible for handling this Python Private heap space .
Python Memory manager Python Allocation of heap space , The core API Allow programmers to use some tools to write code .
Python It also has a built-in grabage The collector , It reclaims all unused memory , And free up memory and make it available to heap space .
6) What tools are available to detect coding errors or perform static analysis ?
PyChecker Is a static analysis tool , It can detect Python The error in the source code and warn about the style and complexity of the error .Pylint It is another tool to verify whether the module conforms to the coding standard .
7) What is? Python Decorator ?
It is a kind of packaging for functions . It can expand the function , Without modifying the code of the function itself . Can increase the function before execution 、 Behavior after execution , Without making any changes to the code that calls the function .
8)list and tuple What's the difference? ?
The difference between lists and tuples is , The list is variable , Tuples are not . for example , The tuple can be hashed as the key of the dictionary .
9) How parameters are passed by value or reference ?
Python Everything in is an object , All variables contain references to this object . The reference value depends on the function ; Therefore, the referenced value cannot be changed . however , If the object is mutable , You can change .
10) What is? Dict And list parsing ?
They are grammatical constructions , It can simplify the creation of dictionaries or lists based on existing iteratible objects .
11)python What built-in types are available ?
Variable built-in type :List、Sets、Dictionaries
Immutable built-in type :Strings、Tuples、Numbers
12)Python What is the namespace in ?
stay Python in , Every name introduced has its place of survival , Can be used . This is called a namespace . This is like a box that maps variable names to placed objects . Whenever you search for variables , Will search this box to get the corresponding object .
13) What is? Python Medium lambda?
It is a single expression anonymous function , Usually used as an inline function .
14) Why? python Medium lambda The form has no statements ?
python Medium lambda The form has no statements , Because it's used to create new function objects , Then return these function objects at run time .
15)Python Medium pass What is it? ?
Transitive representation , No operation Python sentence , Or to put it another way , It is a placeholder in a compound statement , This position should be left blank , Without writing anything in it .
16) stay Python in , What is an iterator ?
stay Python in , Iterators are used to iterate over a set of elements , Containers such as lists .
17)Python Medium unittest What is it? ?
Python The unit test framework in is called unittest. It supports shared settings , automated testing , Close code, etc .
18) stay Python What's the slice in ?
Slicing It's in an ordered object type ( Array , Tuples , character string ) The grammar of a passage .
19)Python Medium generator What is it? ?
python generator Is a simple creation iterator Way , It is a function that can return iterator objects .
20)Python Medium docstring What is it? ?
Python The document string is called docstring, It's a record Python function , Modules and classes .
21) How to be in Python Copy objects in ?
To be in Python Copy objects in , In general , have access to copy.copy() or copy.deepcopy(). These two functions .
22)Python What is the negative index in ?
Python The sequence can be positively and negatively indexed . For positive index ,0 It's the first index ,1 It's the second index , And so on . For negative index ,(-1) It's the last index ,(-2) It's the penultimate index , And so on .
23) How to convert a number to a string ?
You can use built-in functions str() Convert numbers to strings . If you need octal or hexadecimal representation , You can use functions oct() or hex().
24)Xrange and range What's the difference? ?
range Back to a list object , and xrange It doesn't generate a list, Instead, each call returns one of the values , Very little memory space , So the performance is very good .
25)Python What are the modules and packages in ?
stay Python in , Modules are the way to build programs . Every Python Program files are all a module , This module will import other modules , For example, objects and attributes .
Python The encapsulation of the program can be encapsulated into a package , A package can contain multiple modules .