called a submodule (Subpattren). 1.5 optional and repeating sub-modules Add a question mark after the submodule and it becomes optional. (pattern)? : Allow mode to occur 0 or 1 times. (pattern) +: Allow mode to appear 1 or more times. (pattern) *: Allow mode to appear 0 or more times. (pattern) {m,n}: Allow mode to appear m~n times. 1.6 Start and end of string For example, the substring ' www ' in ' www.python.org ' and ' python.www.org ' can match t
language is open source from spec to interpreter, many people have written their own Python interpreter, and eventually python has many kinds, such as: Cpython/ipython/pypy/jython/ironpython. But the most widely used is the CPython. If you want to interact with the Java or. NET platform, you can use network tuning to interact to ensure the independence of each program.Python Input and output:Output: Use pr
can use member operators in a sequence, as well as strings.In, not in. As the name implies, it is used to determine if an element exists and returns a Boolean value, True or false.>>> s = ' abc ' >>> s ' abc ' >>> ' a ' in strue>>> ' a ' in sfalse>>> ' a ' not in strue Gt;>> ' ab ' in strue>>> ' AC ' in SfalseThe above content in the Python3.5 environment test can be run, because I have just started to contact Python and for self-study, so there is n
Python functions(1) Another way to define the data frame is to put the data content (multidimensional array) directly into data, and then define columns and index. (Data frame. Columns is a column name,. Index is the row name, and the type that is taken is similar to the tuple, you can use [0],[1] ... Direct removal)DF = PD. DataFrame (data=[[34, ' null ', ' Mark '], [[a], ' null ', '
', using ' python|jython ' for matching, or just using selection operators for part of the pattern, such as ' (p|j) Ython ', using parentheses to enclose the desired part, Called Sub-mode,
Optional and repeating sub-modes: Adding a question mark after the sub-mode becomes optional, such as R ' (http://)? (www\.)? Python\.org ' can be matched to ' http://www.
the same#2. Value the same type must be the same, but the ID may be different, as follows>>> x= ' Info zhenxi:18 '>>> y= ' Info zhenxi:18 '>>> ID (x)4376607152>>> ID (y)4376607408>>>>>> x = = yTrue>>> x is yFalse6) ConstantsConstants are constant quantities, such as Pai 3.141592653 ..., or quantities that do not change during a program's operationFor example, if a person's age changes, then this is a variable, but in some cases, his age will not change, that is constant. In
number, divisible by//, take surplus%. (eg:1/2=0.5; 1//2=0; 1%2=1)* * denotes power, = denotes assignment, the variable must be defined (assigned) before it is used, and Python supports complex j/j.
String
Python also provides strings that can be represented in several different ways. They can be identified by single quotation marks ( ‘...‘ ) or double quotation marks ( "..." ). \can be used
marks. Similarly, to use the double quotation mark itself in a double-quoted string, you can also help with the escape character. Alternatively, you can use the escape character \ \ to indicate the backslash itself . One notable thing is that in a string , a single backslash at the end of the line indicates that the string continues on the next line instead of starting a new row. For example:"This isthe first sentence.\This is thesecond sentence. "eq
Python learning path-string 11 string
The string type is the most common type in Python. We can create a quotation mark ('and "have the same effect) by including characters. A string is a scalar and an unchangeable type. A string is composed of independent characters, which can be accessed through the slice operation s
can only use expressions, even if the print statement is not in lambda form
EXEC Statement : Used to execute Python statements stored in a string or file, such as:exec ' print ' Hello world! ' ---execution output Hello world! Statement
eval statement : Used to calculate a valid python expression stored in a string, such as:eval (' 2*3 ')---Calculate the value of 2*3;
Assert statement : Used to dec
#本文仅为个人学习过程的整理和记录, if there is a blog from others, the site extracts the content, I will clearly mark, if there is infringement, please contact me, I will be deleted in the first time.The following information is compiled from the (1) Liaoche python tutorial http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000(2) Concise python tutor
: You need to define the type before defining the variable, Python does not need to define the type, directly "=" to defineVariable name to see the name of the understandingVariable names can only be any combination of letters, numbers, or underscoresThe first character of a variable name cannot be a numberThe following keywords cannot be declared as variable names
123
[ "and" , ' as ' , ' assert ' , ' break ' , ' class ' , ' Contin
is called "key" and the corresponding content information is called "value". A dictionary is a collection of key/value pairs. D = {key1:value1, key2:value2}(1) ReferencesPrint D[key1] for name in D:print D[name](2) ChangeDirect Assignment: D[key1]=value3(3) IncreaseD[key4]=value4(4) DeleteDel D[key4](5) Get methodS=d.get (Key)The Get method of the dictionary class is to find the corresponding item according to the given key , if there is no such key, return null value None . (6) Judging whethe
learning the loop statement and the IF condition statement, can be used to write a guess the age of the small program, the requirements are as follows:(1) Guess the age, guess the age is big, the hint bigger(2) Guess age, guess the age is small, the hint smaller(3) Guess right, output age, and congratulations1 #correct age2Age_of_oidboy = 563 whileTrue:4 #enter guessing age5guess_age = Int (input ("Guess Age:"))6 #guess right.7 ifGuess_a
displayed on the screen and require the user to enter data, return the data to the variable, is an assignment operation
int: Change the argument in parentheses to an integer type
See the built-in functions in Python dir(__builtins__) , and what the built-in functions mean help(函数名) (Figure 4)
Variable
Before using a variable, the variable name can include letters, numbers, and underscores, but the variable name cannot be
Lists [List]:Lists are the most basic data structures in Python, and each element in the list is assigned a locationLists are also known as arrays, and arrays can be divided into one-dimensional arrays, multidimensional arrays#one-dimensional arraysList = ['Denny','Jenny','liming','Lilei','Hanmeimei']#Multidimensional Arrays #two-dimensional arrayslist1=[1,2,3,4,[51,52,53,54],6,,78] #three-dimensional arraysList2=[1,2,3,4,[xiaoming[18,175],xiaola#colu
you separate a room with a wall, you're trying to create two different populations in the same room. Similarly, decision trees are dividing the population into different groups as much as possible.
For more information, see: Simplification of decision tree algorithms
Python code
7, K mean value algorithm
k– mean algorithm is a kind of unsupervised learning algorithm, it can solve the problem of clustering.
Python Learning Note 3: Lists and tuplesA list of listsSummary: The list is a mutable variable, and you can modify the value of the element by subscript1. Definition list --brackets []name=[' Lily ', ' Lucy ', ' Meimei ' 2, subscript value --plus or minus number can be 3. Add a value to the list1)Append () method, add a value at the end of the list2)Insert () method, add a value at the specified position
This study note is mainly used to record the basic course of learning The No. 01 Chapter: Basic Knowledge------Jython:python Java implementation, run in the JVM, relatively stable, but behind Python, the current version 2.5, TA (python+robot) will useIronpython:python's C # implementation, run at common Language runtime, faster than
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.