It can be compared with other languages in the answer. first
PythonIt’s an interpretive language. And
CPython code does not need to be compiled before it runs. Other interpretative languages include
PythonIt is also a dynamically typed language, which means that you do not need to specify the type of a variable when you declare it.
PythonIt is very suitable for object-oriented programming, because it supports defining classes through composition and inheritance. stay
PythonEverything in the world is the object.
After answering the characteristics of python, we can talk about the advantages and disadvantages of Python.
PythonThe code is fast, although the running speed is usually slower than the compiled language, but
PythonAllow to join based on
CLanguage, so we can optimize the code and eliminate bottlenecks,
numpyThis is a good example. Python is widely used, not limited to network applications, automation, scientific modeling, big data applications and so on. It is also often used as a “glue language” to help other languages and components improve their performance. At the same time, python makes difficult things easy, so programmers can focus on the design of algorithms and data structures without dealing with the underlying details.
We need to understand why the interviewer asked this question: if you are applying for a job
PythonAs a developer, you should know what kind of language it is and why it’s so cool. And what’s wrong with it.
PEP8Is a programming specification, content is about how to make your program more readable suggestions.
PickleModule reads any
PythonObject, convert them to strings, and then use the
dumpFunction to dump it into a file. This process is called
Instead, extract the original string from the stored string file
PythonObject is called unpicking.
PythonIs an explanatory language, its source code can be run directly.
PythonThe interpreter converts the source code into an intermediate language and then translates it into machine code for execution.
PythonThe memory management of is by private
heapSpace management is very important. be-all
PythonObjects and data structures are in the same private domain
heapIn the middle. The programmer did not access the file
heapOnly the interpreter can operate on it. by
heapSpace allocation memory is made up of
PythonIts core API will provide some methods to access the module for programmers to use.
PythonThere is a built-in garbage collection system, which recycles and releases unused memory so that it can be used by other programs.
PyCheckerIs a static analysis tool, it can not only report errors in source code, but also report error type and complexity. Pylint is another tool to check whether a module meets the code standard.
What’s the difference between arrays and tuples?
The difference between arrays and tuples: the contents of arrays can be modified, while the contents of tuples are read-only. In addition, tuples can
Hashed, such as a keyword in a dictionary.
PythonEverything in is a class, and all variables are references to an object. The value of the reference is determined by the function because
This cannot be changed. But if an object can be modified, you can change it.
PythonIn, all names exist in a space, and they exist and are manipulated in that space
Namespace. It is like a box, each variable name corresponds to an object. When querying variables, the corresponding objects will be found from the box.
This is an anonymous function that is often used for a single expression in code. Anonymous function
lambdaThe reason there is no statement is that it is used to build a new function object and return it when the code is executed.
PassIt’s a place where
PythonStatements that will not be executed in. In complex statements, if a place needs to be left blank temporarily, it is often used as a place holder.
PythoChinese file strings are called
PythonThe role of is to generate documentation for function, module, and class annotations.
How to copy an object in Python（ Assignment, shallow copy, deep copy)
Assignment (=) creates a new reference to an object. Modifying any of the variables will affect the other.
Shallow copy: create a new object, but it contains a reference to the item contained in the original object (if by reference)
If one of the objects is modified, the other will be modified as well.)
Deep copy: create a new object, and recursively copy the objects it contains (modify one, and the other does not)
(it will change)
Single quotation marks and double quotation marks are equivalent. If you want to wrap a line, you need the symbol (\), and three quotation marks can wrap a line directly and can contain comments
This work adoptsCC agreementReprint must indicate the author and the link of this article