You’ve been waiting for the Python interview………
1.python multithreading restrictions and multi process transfer parameters in the way?
Python multi thread has a global interpreter lock (global interpreter lock), the lock means at any time only one thread can use the interpreter to run multiple programs CPU for a mean, everyone is round with, this is called “complicated”, not “parallel”.
You can use multiprocessing.Value and multiprocessing.Array to share data between processes
How does 2.Python manage memory management?
Python references a memory pool (memory pool) mechanism, the Pymalloc mechanism (malloc:n. allocated memory) for managing the application and release of small blocks of memory
Memory pool (memory pool) concept:
When creating large amounts of objects that consume small amounts of memory, frequent calls to new/malloc result in large amounts of memory fragmentation, resulting in reduced efficiency. The concept of memory pool is the pre application in memory of a certain number of memory blocks of equal size in reserve, when a new memory requirements, first from the memory pool allocates memory for the demand is not enough, then apply for a new memory. The most significant advantage of this is that it reduces memory fragmentation and improves efficiency.
There are many ways to implement memory pools, and their performance and scope of application are different.
Memory management mechanism in Python — Pymalloc:
The memory management mechanism in Python has two sets, a set is for small objects, the size is less than 256bits, pymalloc will apply for the memory space in the memory pool; when more than 256bits, it will directly execute the new/malloc behavior to memory. About free memory, when an object’s reference count is 0, python will call its destructor. The memory pool mechanism is also used during the analysis, and the memory from the memory pool is returned to the memory pool to avoid frequent release actions.
3. what is the lambda function? What’s the good of it?
The lambda function is a function that receives any number of parameters (including optional arguments) and returns the value of a single expression. The lambda function cannot contain commands, and they contain no more than one expression. Don’t try to cram too much into the lambda function; if you need something more complicated, you should define a normal function and how long you want it to last.
4. how can I output a Fibonacci sequence with Python?
1 A, B = 0, 1
2, while, b< 100:
3 print (B),
4 A, B = B, a+b
5., describes the use of Python in WebBrowser?
The WebBrowser module provides an advanced interface to display Web based documents, and most of the time simply call the open () method.
WebBrowser defines the following exceptions:
Exception webbrowser.Error, this exception is thrown when a browser control error occurs
WebBrowser has the following methods:
Webbrowser.open (url[, new=0[, autoraise=1]])
This method is shown in the default URL browser, if new = 0, then URL will open in the same browser window, if new = 1, will open a new window, if new = 2, will open a new tab, if autoraise = true, the window will automatically increase.
Open a new window in the default browser to display URL, otherwise open URL in the only browser window
In the default browser, when you open a new tab to display URL, it is the same as open_new ()
Webbrowser.get ([name]) returns a browser object based on name, and returns the default browser if name is empty
Webbrowser.register (name, construtor[, instance])
Register a browser named name, and if this browser type is registered, you can use the get () method to get it.
6. explain the and-or syntax of Python
Similar to the C expression bool: A: B, but bool, and, a, or, B, and when a is false, it does not work like the C expression bool: A: B
And-or skills should be encapsulated into a function:
Defchoose (bool, a, b): return (booland[a]or[b]) 
Because [a] is a non empty list, it will never be false. Even a is 0 or ” or other false values, and the list [a] is true because it has an element.
7.how, do, I, iterate, over, a, sequence, in, reverse, order?
If not list, the most common but slightly slower solution is:
Foriinrange (len (sequence), -1, -1, -1):
How does 8.Python do type conversions?
9.Python inside how to achieve the conversion of tuple and list?
10. write a Python code to delete the duplicate elements inside a list
How does 11.Python implement singleton patterns? How are the other 23 design patterns implemented in Python?
How do you copy an object in 12.Python?
The copy module in the standard library provides two methods to implement the copy. One method is copy, which returns the same object as the parameter containing the content
Using the deepcopy method, the properties in the object are also copied
13. how do you use Python to query and replace a text string?
You can use the sub () method to query and replace, and the sub method is formatted as sub (replacement, string[, count=0])
Replacement is text that is replaced
String is text that needs to be replaced
Count is an optional parameter, which means the maximum number to be replaced
What’s the difference between search () and match () in 14.Python?
Match (RE) function is not only detected in the beginning of the string position, search () will scan the entire string to find the matching, that is to say match (only), succeed in the 0 position is returned, if not start position matching success, (match) or none.
15., there are two sequences a, B, the size is n, the value of sequence elements, arbitrary plastic number, disorder
Requirement: by exchanging elements in a and B, make the difference between the sum of the sequence a elements and the sum of [sequence B elements].
1. combine the two sequences into a sequence and sort them into sequences Source
2. take out the largest element Big, the next big element Small
3., in the remaining sequence S[: -2], bisection is performed to obtain sequence max, min
4. add Small to the max sequence, increase the Min sequence by Big, recalculate the new sequence, and the big one for max, and the smaller for min.
16.python program, how to solve the problem of Chinese output?
Using encode and decode
Add to the beginning of the document
How does 17.python capture exceptions?
(1) using try and except statements to catch exceptions
The detailed reason for the captured IOError error is placed in the object e, and then the except code block running the python exception handler captures all the exceptions
(2) an exception is raised manually by the raise statement:
(3) use the sys module to trace the last exception
The 18.python code gets the intersection and difference sets of the list list
19. how do I send mail with Python?
You can use the smtplib standard library.
The following code can be executed on the server that supports the SMTP listener.
20., introduce the usage and function of except Python’s except is used to catch all exceptions because each error in the Python throws an exception, so each program’s error is treated as a runtime error.
Good students, I could introduce are introduced to you, the part above is what I want to say, if you want to get high salary in the IT industry, we can participate in the training camp course, choose the most suitable for their own course of study, Daniel Qinshou, 7 months after entering a high salary. Our courses include: Java engineering, high performance and distributed, high performance, easy to understand. Viaduct. Performance tuning, Spring, MyBatis, Netty, source code analysis, and big data. If you want to get paid, want to learn to think, good employment prospects, want to compete with others to gain advantage, to enter the interview but Ali but worried about the interview, you can come, group number: 636532962
Note: adding group requirement
1, with 1-5 working experience, the face of the current popular technology, I do not know where to start, need to break through technical bottlenecks can be added.
2, stay in the company for a long time, easy to live, but job interview rebuffed. Need to study in a short time, job hopping, high salary can be added.
3, if there is no work experience, but the foundation is very solid, the Java working mechanism, commonly used design ideas, commonly used java development framework master skilled, you can add.
4, I feel very cattle B, general demand can be done. But the knowledge is not systematic, it is difficult to continue breakthroughs in the field of technology can be added.
5., Ali Java senior Daniel live broadcast, to explain the knowledge, knowledge sharing, many years of work experience combing and summarizing, with all of you, fully and scientifically establish their own technical system and technical knowledge!
6. trumpet or small white and other groups are not given, thank you.