1. Python Environment configuration (2.7 version):
Python official website: https://www.python.org/
Pycharm official website Http://www.jetbrains.com/pycharm/download
Note: Personal learning Download Install community version is enough ~
Install after download (remember to add Python to environment variable OH ~)
2. python file type:
When the Python interpreter executes the Python code, it goes through the following stages:
1) Load code file
2) translate into AST (intermediate result obtained by grammatical analysis)
3) Generate bytecode
4) executing bytecode,pvm on PVM (Python virtual machine) is actually a stack-based VM. (Similar to Java's processing mechanism)
Python can also be executed on different platforms
3. Basic Python syntax
1) Code indentation: Python's most distinctive feature is the use of indentation to write modules. (Standard four-cell indent)
2) Multi-line input: slash \ Divides a sentence into multiple lines (the statement contains (), {}, [] Do not need to use a multiline connector)
3) quotation marks: Single quotation mark ('), double quotation mark ("), three quotation mark (" ' "" ") to represent the string
4) Note: Use # (press ctrl+/), bulk comment can select the line to be commented, press ctrl+/
5) Identifiers: Names of variables, constants, functions, statement blocks, etc., when you are programming (identifiers in Python are case-insensitive)
6) Show multiple statements on the same line: Use semicolons between statements (;) split
4. User input
Both raw_input () and input () are built-in functions of Python, interacting with user implementations by reading the console's input. (If you define A=raw_input, you can enter a value via the keyboard)
Raw_input () differs from input ():
1) raw_input () treats all inputs as strings, returning string types
2) Raw_input () directly read the console input, no type restrictions; input () inputs must be a valid Python expression, and if the input string must be enclosed in quotation marks, it will cause syntaxerror
3) input () is essentially implemented using raw_input (), just call the eval () function after Raw_input () is called, so you can even use the expression as an argument to input (), and it evaluates the expression and returns it.
Example:
Raw_input_a = Raw_input ("Raw_input:")
Input_a = input ("Input:") (Error)
Type (INPUT_A)
5. Python variables
1) Variable assignment: No declaration is required, the left side of the equals (=) operator is a variable name, and the right side of the Equals (=) operator is the value stored in the variable.
2) Multiple variables are assigned: a = b = c = 1 D, e, F = 2, 3, and "John" are both assignable in either way.
6. Python Variable classification
1) Immutable variable: number, tuple (), string (when the value changes to a new address)
2) mutable variable: list [], Dictionary {} (value changed, id unchanged)
Note: The above types we will talk about in the next section Oh ~
The same is the Python small white, above is in the study summary, if has the question to welcome everybody to point out, looks forward and everybody exchanges the study ~
Python three-minute primer