The range function that is commonly used in loops, such asFor I in range (10)Print (i)The range here is a built-in function in Python.It has a parameter of Start_value,stop_value,step_valueRange (Start_value,stop_value,step_value)#start_value start
Installing pluginsIt feels good to write code under sublime Text3, but there are some problems when writing python.Open the Python file with sublime Text3, or write the Python code under sublime Text3, use the shortcut key ctrl+b to run, and the
Input summary in Python 21.raw_input (prompt = none) with input (prompt = none)Two are the default parameter types, which can be passed in a string that is used for input when output, such as1 # Well, your name is really a good movie . 2 your_name =
1, no permission control, before the class method or variable with "__" two underscores, then become "private" variable (actually through the ___ can be accessed)2, the class of several automatic triggering of the built-in method:
__new__
See machine learning to see the regression function, see half can not go down, see to be able to use the variance function regression, and hand itch, oneself push Formula write code verification:the common least squares method is the first order
Python if __name__ = = ' __main__ ' What's hell is it?Python believes that all modules can be executed or importIf a module is imported by import, the caller of the module may just want to use part of the module's code instead of running it
First, the Environment preparation1. Download the Python installation package (to the official website)https://www.python.org/downloads/Recommended download Install the latest version2. Set "Environment variables"My Computer---Properties----advanced-
The benefit of using the generator is obvious, it can make the code clearer, while reducing the memory consumption, when the function needs to return the list, it is relatively easy to rewrite the function as a generator.The following two functions
1. Strip () functionStrip () is the deletion of the characters inside the ' () ', and when () is empty, the default is to remove the whitespace (including ' \ n ', ' \ R ', ' \ t ', ')(1) S.strip (RM) Remove the characters from the beginning and end
mutable types and immutable types in Python:Before we talk about Python-depth copies, we should first understand the types of elements in Python: they are mainly classified as mutable types and immutable types.A mutable type is two of the types of
It is convenient to check the Python method with tab completion in peacetime.
1. The Mac platform is configured as follows:
Mac is a Unix-like platform that needs to add a configuration to Bash_profile (default is no this
1, the Python program deployment to the SAE need to make changesRun Python programs on-line that need to be converted into WSGI.Running a python program in the SAE requires specifying a function as an entry function.Application = Sae.create_wsgi_app
Crawl through the network1 when we visit the entire network, we will inevitably visit different sites, but different sites will have a completely different structure and content ...Now step-by-step build a script that accesses the entire networkI
To achieve the effect of multiple iterators, __iter__ () simply defines the new state object for the iterator instead of returning the self1 classskipiterator:2 def __init__(self, wrapped):3self.wrapped =Wrapped4Self.offset =05 6 def __next__
Three-time handshake of TCP in the socket to establish a connectionWe know that TCP establishes a connection for a "three-time handshake", which is the exchange of three groupings.The process is as Follows:
The client sends a SYN J to the
Enumerate usage Summary-Python 3, enumerate-pythonEnumerate () Description
Enumerate () is a python built-in Function
Enumerate indicates enumeration and enumeration in the dictionary.
For an iterable/traversed object (such as a list or string),
Zip function-Python 3, zip function-python
The zip function accepts any number of (including 0 and 1) sequences as parameters and returns a tuple list.
The zip function is easier to generate a dictionary (dict) after obtaining data.
For examples:
Windows: Windows Flask
Prerequisites:
1. python version installed (generally 2.X)
2. easy_install is installed.
When installing python, remember to configure the Python environment variables. For example, I directly add G: \ Python to the
Add tab completion and pythontab completion in python
It is quite convenient to use the tab to complete the Python method.
1. The mac platform configuration is as follows:
Mac is a Unix-like platform. You need to add a configuration
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