1.Python It's such a language
* Python It's a cross platform course , Open Source , Free interpretive high level dynamic programming language .
* Python Support command programming , Functional programming , Fully support object oriented programming , Has a large number of extended libraries .
* Glue language : It can integrate programs written in different languages to achieve seamless splicing , Make better use of the advantages of different languages and tools , Meet the needs of different application fields .
Take two examples :
2.Python Programming specification and optimization suggestions
(1) indent
* Class definition , Function definition , Selection structure , Cyclic structure ,with block , The colon at the end of the line indicates the beginning of the indentation .
* python Programs rely on the indentation of code blocks to reflect the logical relationship between codes , The end of indentation means the end of a code block .
* Code blocks at the same level must be indented the same amount .
* generally speaking , with 4 Spaces are the basic units of indentation .
(2) each import Statement imports only one module , It's better to use the standard library , expanded memory bank , Custom libraries are imported in turn .
(3) It's best in each class , Add a blank line after the function definition and a complete function code , Add a space on each side of the operator , Add a space after the comma .
(4) Try not to write too long sentences . If the statement is too long , Consider splitting into shorter statements , To ensure that the code has good readability . If the statement is really too long for the screen width , It's best to use line continuation (line
continuation character)“\”, Or use parentheses to enclose multiple lines of code to indicate a statement .
(5) although Python Operators have clear precedence , However, for complex expressions, it is suggested to use brackets at appropriate positions to make the membership and order of various operations more clear , clear .
(6) notes
* With symbols # start , Indicates the bank # This is followed by comments .
* Enclosed in a pair of three quotation marks ’’’…’’' or """…""" Content that does not belong to any statement will be considered as comments by the interpreter .
Technology