1. Variables and values:
Python is a dynamic type language and does not need to declare the variable type in advance. The variable type is initialized at the moment of value assignment. Python variable names are case sensitive, that is, "case" and "case" are different variables. python is case sensitive.
2 digits:
Python has five basic types of numbers. INT (signed integer), long (long integer), bool (Boolean), float (floating point number), complex (plural ). It is worth noting that python's long integer type is much wider than the range of C. It is limited to the Total virtual memory of the user's computer. In future versions, it is very likely that python will not distinguish between integer and long integer, but will unify the two types into long integer. The type of plural is usually not directly supported in other languages. The support for plural is a personalized feature of Python.
3String:
Strings in Python are defined as character set combinations between quotation marks. Pair single quotation marks, double quotation marks, and three double quotation marks (three consecutive single or double quotation marks) can be used to represent strings. Three quotation marks support multiple rows. String supports index operators [] and slice operators [:]. For example, if X = 'abcde', the value of X [0] is 'A', and the value of X [4] is 'E '. In addition, Python supports negative index values. The value of X [-1] is 'E', which is the last element in the string sequence, the value of X [-2] is 'D', which is the second-to-last element in the string sequence. If you want to know more, you can seePython listThis one.
4. Comment "#"
The comment Statement of Python starts with "#" and ends with a line.CodeIt is very helpful for cooperative development, so we need to develop this good habit.
We hope that the above basic Python knowledge will allow you to understand the features of python in a short time. You have learned the basic knowledge.Python MySQL installation package
Python search for Web keyword ranking Python code format problems Python OOP private Mechanism Python overload Python is Python Lambda
5 code blocks and indent alignment
Python code blocks express code logic through indentation alignment, rather than using braces (from now on, say goodbye to the sacred braces war). Python supports tab indentation and space indentation, but PythonCommunityWe recommend that you use four spaces for indentation. You can also use tab indentation, but do not use mixed indentation symbols.
6; semicolon:
The semicolon (;) allows multiple statements to be written on the same line. The statements are separated by semicolons. These statements cannot start a new code block on this line. Although this can be done, Python does not advocate the use of ";" to write multiple statements in one line, which is not easy to read the code, and is not convenient for code extension and maintenance in the future.
7 OPERATOR:
Because python is a strongly typed language, if you are using an operator, for example, a plus sign (+), you must first unify the types of the two operands rather than directly performing operations. For example, an operand is a character type, if a number is used, python will report the following error: typeerror: Unsupported operand type (s) for +: 'int' and 'str'