One, Python four types of data formats
Integers---- 2, 3,
Long integers: Refers to integers that are larger than
floating point---- 3.23, 52.3E E: The token represents a power of 10.
plural----( -5+4j), (2.3-4.6J)
Two, Python string
A single quotation mark: the single quote output string, and the string is left intact.
Input: ' What ' s your name ' Output:what ' s your name
b Double quotation marks: the same as single quotes, leaving the source string as is output.
C Three quotation marks ("' | ""): the output of a multiline string can be followed as indicated.
"This is a string
The second line
He said "You is good"
’’’
D escape character (\)
input "what\ s your name?"
output "What ' s your name?" "
E Natural string: Do not require special handling with the swivel chair character. The system is recognized by adding R or R directly before the string.
input:r "What ' s your name"
Output:what ' s your name
The F-string is immutable: Once your string is created, you can no longer change it.
G literal cascading string: If you put two strings in a literal order, Python will automatically connect them together.
input "What ' s" "Your Name"
Output what ' s your name.
Third, Python variables
Naming rules for variables: (1) The first character of a variable name must be either a character (uppercase or lowercase) or an underscore.
(2) Other parts can be letters (uppercase or lowercase), underscores, numbers.
(3) There is a difference between the uppercase and lowercase letters in the variable name.
Iv. specific examples of Python scripts.
(1) General input and output:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7E/03/wKioL1b1AaaQI1cJAAAf_NEHe8Y365.png "title=" 09115a8d-163f-4fa3-b988-81d6c8f0eddd.png "alt=" Wkiol1b1aaaqi1cjaaaf_nehe8y365.png "/>
(2) An example of an expression:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7E/03/wKioL1b1AabiMm8nAAAdlKyHaTs434.png "title=" 9562aa66-6914-45a0-b3d7-e10b0d912d6d.png "alt=" Wkiol1b1aabimm8naaadlkyhats434.png "/>
(3) Examples of If/else statements:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7E/03/wKioL1b1AafjyjBtAABY_PJ666s654.png "title=" Acc71393-b31e-42e5-9d23-9620b7be14a2.png "alt=" Wkiol1b1aafjyjbtaaby_pj666s654.png "/>
(4) example of a while statement:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7E/06/wKiom1b1AQ3A6I69AAA_fi6h6_k956.png "title=" D281fb89-fdba-4dac-b98b-7acc29d5c247.png "alt=" Wkiom1b1aq3a6i69aaa_fi6h6_k956.png "/>
(5) For loop example:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7E/06/wKiom1b1AQrBbhGiAAAc-8P4KJw465.png "title=" 8ab39ca6-e5e2-4f47-b39b-e3aa4febc973.png "alt=" Wkiom1b1aqrbbhgiaaac-8p4kjw465.png "/>
(6) An example of a break:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7E/06/wKiom1b1AQqCKWW8AAAl8wPLJOg237.png "title=" 1bf441e8-1d6d-40cd-8aaf-4d425c684ffd.png "alt=" Wkiom1b1aqqckww8aaal8wpljog237.png "/>
(7) Continue usage Example:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7E/06/wKiom1b1AQuy_5rFAAApuTMKLjI339.png "title=" 79cbd871-9ad4-45ef-b818-1af809ccd24f.png "alt=" Wkiom1b1aquy_5rfaaaputmklji339.png "/>
(8) Examples of functions in Python:
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7E/06/wKiom1b1AQqhBDWUAAAu1MH_Q3o144.png "title=" 0f11ca7d-6768-4c66-aec9-3435cd081756.png "alt=" Wkiom1b1aqqhbdwuaaau1mh_q3o144.png "/>
(9) Examples of local variables use:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7E/06/wKiom1b1AQ2xXS0CAAAjQ9wiwe8806.png "title=" B93faba9-0613-45a9-86ee-51308d636c38.png "alt=" Wkiom1b1aq2xxs0caaajq9wiwe8806.png "/>
(10) Examples of global variables use:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7E/03/wKioL1b1AaWAV0BuAAAmFHv529s119.png "title=" 2139d3c8-0332-4cbf-8481-a321fb9ca46e.png "alt=" Wkiol1b1aawav0buaaamfhv529s119.png "/>
The output is:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7E/03/wKioL1b1AaawoDmhAAAZEFG0Ffo009.png "title=" 8104128d-e155-4ec4-900a-363268ad96cf.png "alt=" Wkiol1b1aaawodmhaaazefg0ffo009.png "/>
Example of use of the return statement:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7E/06/wKiom1b1A6nxpWUsAAAdlKyHaTs117.png "title=" 9562aa66-6914-45a0-b3d7-e10b0d912d6d.png "alt=" Wkiom1b1a6nxpwusaaadlkyhats117.png "/>
This article is from the "Chan_yeol" blog, make sure to keep this source http://bkarryforhero.blog.51cto.com/10700762/1755289
Python Basic Learning Notes