From the original "Hello World", go to object-oriented, to look back and see if there is anything missing in the tutorial.As we mentioned before, "Everything is Object". So let's take a deep look at this sentence.Need to first introduce two built-in
Three basic elements contained in Python: ID (Identity), type (data type), value
= = is used to compare value (value) of two objects for equality,
IS is used to compare the IDs (identity) of two objects for equality
= = Example:
1.URLErrorFirst explain the possible causes of Urlerror:
Network is not connected, that is, the computer cannot surf the internet
Cannot connect to a specific server
Server does not exist
In the code, we need to surround and
First of all, this is a classic question.Let's first make a comparison:The first parameter of the Classmethod is the CLS, which is called to pass the class to theThis means that we can use the properties of the class in Classmethod instead of the
List1list : array of hormones hitArray ( scores) is a structure that can store only the same data type ; array : scores[43] = [12.0, "Hello"]tuples ( tuple can store multiple data types, but cannot change the elements;definition:: A list of
List1list : array of hormones hitArray ( scores) is a structure that can store only the same data type ; array : scores[43] = [12.0, "Hello"]tuples ( tuple can store multiple data types, but cannot change the elements;definition:: A list of
What ' s the function? definition of the function: (return is the returned value, no, but none if not)def Wrapper (parameter 1, parameter 2,*args, default parameter, * *Kwargs) :' Comment: function function and parameter description '
1.numpy.random.rand ()Usage is: Numpy.random.rand (d0,d1,... DN)Creates an array with the given shape and adds a random sample evenly distributed between [0,1] in the array.usage and implementation :>>> Np.random.rand (3,2) Array ([[0.14022471, 0.96
Adorner Open closure principleOpen: The extension to the function is openClosed: The modification of the function is closedThe role of adornersAdd new functionality to the original function without changing the way the original function is called#①
One, synchronous and asynchronous:In program execution, running synchronously means waiting for the returned result of the called function, thread, subprocess, etc. to continue processing, asynchronously means to run the program under the main
Objective:Requests IntroductionRequests is an HTTP library that uses Apache2 Licensed licenses. Written in Python, really for the sake of mankind.The urllib2 module in the Python Standard library provides most of the HTTP functionality you need, but
Python file type source code
Python source files with "py" extension, interpreted by the Python program, do not need to compile
BYTE code
Python source files are compiled with a file with the extension "PYc"
Compilation methodimport
Python decoratorDefinition: The essence is a function, (decorating other functions) is to add additional functions for other functionsPrinciple:1. Cannot modify the source code of the decorated function2. Can not modify the original function call
This code implements the manual click Start and end point, the program automatically determine the distance, touch screen time to complete the jumpImportNumPy as NPImportMatplotlib.pyplot as PltImportMatplotlib.animation as animation
With the keyword yield, you can generate a value from the generator and return it. We can use the generator as a producer .In the process, by using the keyword yield, you can also let a program with yield receive values. At this point the function
In multi-threading, locking is required for operations that share data in common.However, for local variables , each thread is independent of each other.If the thread t want to F1 the function in the local variable V1 to the function F2, F2 again
1 Introduction to Python What language is 1.1 python?
Python is a dynamically explanatory, strongly typed definition language.
The characteristics of the compiler type: The consistency is poor, running fast.
Python built-in functions
Dir (_ builtins __)
1. 'abs '. Obtain the absolute value of the input parameter.
abs(x, /) Return the absolute value of the argument.
1 >>> abs(10)2 103 >>> abs(-10)4 10
2. 'all' is used to determine whether all elements
Problems that beginners often encounter when learning python.
1. python2 or python3?
New users often think about this for a long time. The syntaxes of 2 and 3 are roughly the same, but the changes are not significant. For example, print xxx in
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service