Start learning Liaoche's py2.7 tutorial:June 5, 2017 12:54:28Notes:Liaoche python2.7 Tutorials1. Developing programs in any programming language is all about making computers work.2.Python is a fairly advanced language. Not enough code? The low cost
7-9. Translation(a) writing a character translation program (functionally similar to the TR command in Unix). We call this function tr (), which hasThree string parameters: source string, Destination string, basic string, syntax is defined as
Python's strength is that he has a very rich and powerful standard library and third-party library, almost any function you want to implement has the corresponding Python library support, later in the course will be in depth to explain the various
Exception handling1 #! Usr/bin/env python2 #-*-coding:utf-8-*-3 #Author Calmyan4 5list_l=['g','h']6data={'a':'3'}7 Try:8 #list_l[3] #IndexError: List index out of range9data['2q']Ten exceptIndexerror as E:#list subscript out of bounds One
Install PIP:Download Pip:https://github.com/pypa/pip to GitHubAfter extracting, open the command line in the extracted folder, enterPython setup.py InstallAfter the installation is complete, configure the system environment variable: after path,
ImportMatplotlib.pyplot as Plt fromMpl_toolkits.axes_grid1.inset_locatorImportzoomed_inset_axes fromMpl_toolkits.axes_grid1.inset_locatorImportMark_insetImportNumPy as npfig, Ax= Plt.subplots (figsize=[5, 4]) y= x = Range ( -20,20) Ax.plot (x, y)
Actions in the listGet the values in the listList1 = [' Running Man ',' bee maiden ', 2015,2016= [1,2,3,4,5,6,7 ]print ("list1[0]:", list1[0])print(" List2[1:5]:", List2[1:5])# Remove the value of the tag 1,2,3,4Update the values in the listList1 =
Role:The setattr function corresponds to the function Getatt (), which is used to set the property value, which must exist.Grammar:SetAttr (object, name, value)
Object--Objects.
Name--String, object property.
Value--Property values.
device = Mr.waitforconnection (1,devicename)When using waitforconnection, devices always return an object regardless of whether the device is connected, so there is no way to accurately determine if the device is actually connected successfully
List built-in functions
#!/usr/bin/env python# -*- coding:utf-8 -*-# class list (object):# "" "# list () -> new empty list# list (iterable) -> new list initialized from iterable ' s items# "" "## def append (Self, p_
Several files are required:1.wordlist.txt, which is the word list you want to convert to vector:Springmavenjunitantswingxmljrejdkjbuttonjpanelswtjappletjdialogjcheckboxjlabeljmenuslf4jtestunit2.label.txt, which is the label shown in the figure, can
a standard data type1 shaping and floating-point shapesThe difference between python2.* and python3.* about integral type python2.* on 32-bit machines, the number of integers is 32 bits, the value range is -2**31~2**31-1, that is -2147483648~21474836
1. Data typeData types in PythonPython uses the object model to store data, each of which has a built-in class, and each new data is actually initialized to generate an object, that is, all the data is objects.2. String2.1 DefinitionsDefinition: It
In Python, how can you do this if you want a class to create only one instance object?Ideas: 1. Different objects created from the same class are directed to the same direction.2. Allow a class to create only unique instance objects.Method: Use _
Python Private Public attribute, python private
In python, variables outside the class are called attributes, and variables in the class are called fields. Their private public access methods are similar.
1 class C: 2 _ name = "private property" 3
Python database operations-Installation and python database operations
First, download the software:
Link: http://pan.baidu.com/s/1nvp1imX password: 6i0x
Then there is a series of settings.
Installation Tutorial: Just click Baidu. Note that you
Python learning: (2) automatically play 2048 games, python2048
Preface
2048 have you ever played the game? Https://gabrielecirulli.github.io/2048/ can play online
People are always limited in energy and cannot play games day or night, But machines
Map, map.baidu.comPython3.6
map(func, *iterables) --> map objectMake an iterator that computes the function using arguments fromeach of the iterables. Stops when the shortest iterable is exhausted.
map(func, *iterables) --> map object
The func
Python 36th days ----- special member methods in the class, python 36th days
_ Doc _ view the description of the tip
_ Module _ indicates the module where the current operation object is located
_ Class _ indicates the class to which the object of
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