First, the knowledge Point collation 1, the difference between Python2 and Python3: (1) macro-to Python2 source code is not standard, more chaotic, and duplicate the number of codes. PYTHON3 source unified the standard, but also to remove the duplication of code. (2) Encoding alignment Python2 The default encoding is ASCII. PYTHON3 The default encoding is Utf-8 (can recognize Chinese). PS: corresponding to the Python2 encoding problem, you can add #-*-encoding:utf-8-*-solution at the first line of the code.  2, Python's environment is divided into "compiled" and interpreted type; compilation refers to the one-time compilation of all programs into binary files. Pros: Run fast Cons: Low development efficiency, no cross-platform implementation language: C/C++/GO/S Wift/object-c/pascal interpretation refers to the reason that the compiler will interpret the code one line at a time when the program executes. Advantages: High development efficiency, can be executed across platforms. Cons: Slow running. language:js/python/ruby/php/perl/erlang ps:java and C # belong to mixed languages; ps:python is a dynamic interpretation of the strong class definition language; 3, variables are the intermediate results of some operations are staged into the content, so that subsequent code calls. Format: variable name = value &NBsp Naming requirements: 1) variable names must have any combination of numbers, letters, and underscores, but not the number beginning. 2) cannot be a keyword in Python, the range of keywords is "[' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ', ' finally ', ' for ', ' from ', ' global ', ' if ', ' Import ', ' on ', ' is ', ' lambda ', ' Not ', ' or ', ' pass ', ' print ', ' raise ', ' return ', ' Try ', ' when ', ' with ', ' yield '] ' 3) variables are descriptive, such as the name variable can be defined as "name" and cannot be defined as "asss". 4) variable naming cannot be in Chinese. 4, constants are a constant amount, and names are best capitalized. 5, annotation is to facilitate themselves and others to better understand the code. single-line comment:# Multiline Comment: "Annotated content" ' or ' "" Annotated Content "" " 6, user interaction in Put input command: 1) Wait for user input; 2) to assign the input to the previous variable; 3) input data type is all str type, 7, the base data type can be divided into three kinds of 3 kinds, numbers, strings, Boolean type (for the time being described in these three). int (integer type) on a 32-bit machine, the number of integers is 32 bits, the value range is -2**31~2**31-1, that is -2147483648~2147483647 on 64-bit systems, the number of integers is 64 bits, the value range is -2**63~2** 63-1, i.e. -9223372036854775808~9223372036854775807 string conversion to numeric usage is int (str) PS:STR must be a digital component of Digital conversion to string usage is str (int)   ; Long integer Unlike the C language, Python's long integers do not refer to the positioning width, i.e. python does not limit the size of long integer values, But in fact, because of the limited machine memory, we use a long integer value can not be infinitely large. PS: Since Python2.2, if an integer overflow occurs, Python automatically converts the integer data to a long integer, so there is no serious consequence of not adding the letter L after long integer data. Note: There are no longer long types in Python3, all int str (string type) Python all enclose a string in quotation marks (single or double quotes). features: Add-on: string The stitching. can be multiplied: str * int   BOOL (Boolean) are divided into true and false two types. second, the basic order collation1, print output command, such as print (123) or print (' 123 ')2, type is a built-in function, call he can get a return value, to know the object type information to query, such as print (123,type (123)) 3, Input command, the program waits for the user to enter a value, the value is all character type. For example, the variable name = input (' Please enter your name! ') 4, ' single quote: When a string contains double quotation marks, it can be enclosed in single quotation marks. Double quotation marks: When a string contains single quotation marks, it can be enclosed in double quotation marks. "" "Multi-quotes: When a string is multi-line, you must enclose it in multiple quotation marks. 5. String concatenation: For example, name + age, the name variable (str) is stitched on the age variable (str) name * 10, which indicates the output name variable (str) value 10, and it is all stitched together. 6, Operator Description: 7, logical operation: 8, assignment operation: 9, if flow control statement Single branch format: If condition: Meet the conditional code of execution two-branch format: If condition: Meet conditional execution CodeElse
If condition does not satisfy go to this code multi-branching format: If condition: satisfies the conditional execution codeelif Conditions:
The above conditions are not satisfied.elif Conditions:
The above conditions are not satisfied.elif Conditions:
The above conditions are not satisfied.elif Conditions:
The above conditions are not enough. 10, while loop statement basic loop format: While condition: # loop body Loop termination statement: 1) Bre AK: Full stop cycle 2) Continue: Single Stop cycle
Getting started with Python Basics point finishing-20171214