Python learning 3 --- sequence, list, tuples, python ---I. Sequence
1.1 sequence Concept
The most basic data structure in pythn is sequence ).
Each element in the sequence is assigned a sequence number-element index. The first index is 0, the second is 1, and so on. Similar to the subscript In arrays and collections in JAVA.
From the back to the front, the last i
screen, install and then enter Anaconda in the new Window command line and click on the first option to install.Modify in Settings-defaultAfter Python_interpreter is the Python default installation location, my Python installation directory is in E:\Python\python.exe, note the backslashThe Settings-user is configured
Python learning-stage comprehensive exercises 3. python Comprehensive ExercisesPython learning-comprehensive phase Exercise 3
Based on the previous class learning, do the following example exercises: operations that contain folders and files (do not read the code first, and try to write it first. The code is for refere
command window, perform pip install PEP8 pyflakes2. Switch to Sublime Text software,3. Install the SUBLIMELINTER-PEP8, Sublimelinter-pyflakes plug-in4.preferences->package settings->sublimelinter->settings5. On the right side of the popup window (User), enter the following:{"Pep8": {Whether to show Pep8 check (true to show, false not shown)"@disable": true,"args": [],"Excludes": [],"Ignore": "",Limit the length of each row to 120"Max-line-length": 12
Python 3 Study Notes (5) ---- variables, recursion and high-level functions, python high-level functions
I. Variables
1. the variables defined in the subroutine are called local variables, and the variables defined at the beginning of the program are called global variables.2. The global variable scope is the whole program, and the local variable scope is the sub
issues (i.e. m OST probably bug)//"F": Fatal for errors which prevented further processing "ignore": [],//a list of strings of Individu Al errors to disable, ex: ["C0301"] "Disable": [], "plugins": []}Sublimetmpl new File template plug-in1. Set up your own information in the Settings-user:{"Disable_keymap_actions": false,//"all"; "Html,css" "Date_format": "%y-%m-%d%h:%m:%s", "attr": {"author": "Chen", "email": "[email protected]", "link": "/HTTP/ www.baidu.com/"}}Terminal Open a command window
Python basics 3: re Regular Expressions and python Regular Expressions
A regular expression (or RE) is a small, highly specialized programming language embedded in Python that only matches characters.
1. Character Type:
Common characters and metacharacters;
1) common characters: Most characters and letters will mat
Python learning diary 3 variable 2, logical judgment, for loop, python variable
Review the questions that occur when you write a quiz code.
The condition in the While statement. It should be when result = false and answer = input. If answer = input () is written outside the while clause, too small will be output as it was yesterday.
There is also the if statement
Section 1 Python also has a good data type: String 2. A String is a String written in ''or" ". 3. Set the brian variable to" Always look on the bright side of life.! "[Python] # Set the variable brian on line 3! Brian = "Always look on the bright side of life! "Section 2 1 Exercise 1 set the variable caesar to Graham 2
return, enter the assembly name, and then return to the installation:
Anaconda
Anaconda is currently the best Python autocomplete and syntax hint plugin in Sublime 3, and provides "jump to Definition", "Find and use", "Show Documents", "Auto Rename" functions of plugins in the IDE.
Djaneiro
Provides support for Django
the stack to overflow.Vi. Anonymous functionsAn anonymous function is one that does not require an explicit function to be specified#这段代码def Calc (n): return N**nprint (calc) #换成匿名函数calc = Lambda n:n**nprint (Calc (10))Actual use of the case listres = map (lambda x:x**2,[1,5,7,4,8]) for I in Res: print (i)Output125491664Seven, higher order functionsA variable can point to a function, which can receive a variable, and a function can receive another function as a parameter, a function calle
causes another exception), the entire try statement will be executed after the control is complete.* If the exception occurs in the try code block and there is no matching limit t clause, the exception will be passed up to the program before entering try, or to the top layer of the process (use python to terminate the program and print the default error message)* If no exception occurs in the statements executed under the first line of try,
"package control:list packages", select and enter, all the plug-ins will be displayed.3.2.2 Installing plugins(1) View installed plugins use CTRL + Shift + p to bring up the command panel(2) Enter "Install", in the drop-down list to find "package Control:install package", select and enter, all the plug-ins will be displayed.(3) Installation Sublimecodeintel: auto-complete + Member/methodAfter the installation is complete, you can see the installed pl
field, and the price to the Value field. The quantity and amount of price are calculated separately and summarized by row and column.# pivot Table pd.pivot_table (df_inner,index=["City"],values=["Price "],columns=["size"],aggfunc=[len,np.sum],fill_value=0,margins=true"8, data statisticsThe nineth part is the data statistics, here mainly introduces data sampling, standard deviation, covariance and correlation coefficient use method.Data samplingData sampling functionality is provided in Excel's
") compiled code:Builtins. Print ("Hello, world ")
If you are interested in builtins. Print, you can check it by yourself.
2. String interpolation (string insertion)
String interpolation makes string formatting easy. Let's look at the example:
Toy = "kitty"Print "Hello, $ {toy }"
Any valid boo expression can be inserted into the string. When a string is expanded, boo calculates the expression and then calls the tostring method of the expression result. You can write a few lines of simple code
Python commands. Start the interpreter and wait for the main prompt >>>. (It doesn't take long.) ) 3.1.1. Digital
An interpreter can be used as a simple calculator: You can enter an expression into it and it will return its result. The expression syntax is very simple: the operator +,-, * and/is used in the same way as other languages (for example, Pascal or C); Parentheses (()) can be used for grouping. For example: >>>
>>> 2 + 2
4
>>> 50-5*
the code in a file. First, we can use python
3. The third method is to directly double-click the. py file in windows. This is not enough. We basically do python in Linux.
4. Imports reloads. This is very important. The import command can directly import a py file. The specific search path is described in Chapter 15th. For example, import script4. Note that scr
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.