First configure the Environment installation Zlib,zlib-devel,openssl,openssl-develYum install Zlibyum install zlib-develyum install Opensslyum install OpenSSL-develRecompile the installation python3.5Install package path after CD python
If you want to generate list[1,2,3,4,5,6,7,8,9], you can use range (1,10):If you want to build [1*1,2*2,3*3,4*4,5*5,......, 9*9] Like this, you can use loops:Using a list-generated formula, you can replace the above loop with a sentence:The basic
Example:List1 = [1, 2, 3, 4, 5, 6, [6, 7, 8,9], ' Hi ', ' hello ', 6]List2 = [7, 8, 1, 2]List3 = [' good ', ' well ', ' apple ', ' bye ']Increase(1) Add an element at the end of the list: "End"List1.append ("End")(2) Insert an element in the setting
When binding properties, if we directly expose the properties, although it is very simple to write, but there is no way to check the parameters, resulting in the result can be changed casually:s = Student () S.score = 9999 This is obviously
Iterators: Is a way to access elements within a collection iterator creation and access:>>> list = [1,2,3,4]>>> it = iter (list) # iterator creation >>> next (IT) # access iterators, accessible only through next (), cannot be accessed by index 1>
Brief introductionRPYC (Remote Python Call) provides an excellent base platform for distributed computing environments. Using RPYC to write C/s structure program, regardless of old-fashioned socket programming, now only write a simple 3, 5 lines of
Python 3.xTwo commands are required to write output to a file. Open indicates what file name Python uses, w means that we want to write to the file,Encoding= "Utf-8″ indicates how Python writes Chinese to the file. A print (print) statement that
List : list is a comma-separated list of elements written in square brackets ([])List creation:List1 = List (' adb ')Print (Type (LIST1))A = [' A ', ' B ', ' C ']n = [1, 2, 3]x = [A,n]Print (x)Output Result:class'list'>[['a' ] b ' ' C '], [1, 2,
Reference:Http://www.wklken.me/posts/2013/07/19/python-translate-decorator.htmlHttp://www.cnblogs.com/wupeiqi/articles/4980620.htmlFirst, the necessary knowledge of the adorner1, function can be assigned to a variabledefShow (msg):Print(msg)#call
This section understands the simple use of some adorners.First of all, a preliminary knowledge, a function as a parameter, passed into another functionFor example, I passed outer (F1), I passed in F1 's memory address, A=func () actually executed
View the version of Python#python-VPython 2.6.61. Download Python-2.7.3#wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz22. Unzip#tar-JXVF python-2.7.3.tar.bz23. Change the working directory#cd Python-2.7.34. Installation#./configure#make
ImportMatplotlib.pyplot as Plt#The slices would be ordered and plotted counter-clockwise.Labels ='Frogs','Hogs','Dogs','Logs'Sizes= [15, 30, 45, 10]colors= ['Yellowgreen','Gold','Lightskyblue','lightcoral']explode= (0, 0.1, 0, 0)#Only "Explode" the 2
Python Decorator This thing for beginners is a pit, it is easy to go around the halo, the author at that time, I took a few days to explore the adorner, looked at different lecturers on the content of the explanation, or smattering.But the decorator
Two basic elements of recursion:(1) boundary condition: determines when recursion is terminated, also known as a recursive exit. (n = 1)(2) recursive mode: The big problem is how to break it down into small problems, also known as recursive bodies.
1. What can I store in the list?Can hold any type of data,List1 = [' I love you ','I loved you', 1314]print( LIST1)2. Adding elements to the listAppend (adds a parameter to the end of the list as an element)List1 = [' I love you ','I loved you', 1314
1,linux:# # You need to install the PYTHON2 environment before installing PYTHON-PIPYum Install Python-pipWhen you install PYTHON-PIP with the CENTOS7 Package Manager, Yum will report an error:No Package Python-pip available.Error:nothing to doSays
A byte of Python fourth operator and expressionOperatorOperator Precedence(operators typically combine left-to-right, that is, operators with the same precedence are evaluated in left-to-right order.) For example, 2 + 3 + 4 is calculated as (2 + 3) +
1while statement, when the condition is true, it will continue to loop, such as the following example, but can be used ctral + C to force the end while ' C ' : print ("iLove you")2. Observe the number of printsTen while 0 : print ("iLove you")
Special Python and special Python
Before learning python, I also learned C, C ++, Java, PHP, javascript, and front-end. However, during the course of studying Python, I feel more or less the difference and particularity of Python in terms of syntax.
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