Key points of study today (source: Liao Xuefeng official website)
Python data types include:
- Integer
- Floating point number
- String
- Boolean value
- Null value
Take a look at the difference between each data type:
- Integer: Contains a positive integer, a negative integer, and 0. For example: -120,0,200, etc.;
- Floating point: That is, the number with a decimal point. For example, 1.0,1.65, etc.;
String: The string is any text enclosed in single quotation marks "or double quotation marks", such as: ' Xiao Ming is 3 years old this year, or a baby ', "XYZ" and so on;
- If the string contains both ' and contains ', you can use the escape character \ to identify it (see ' or ' before it is inserted. For example: ' I ' m "OK"! ' means the string content is I ' m "OK"!;
- Escape characters can escape many characters, such as \ n for line breaks, and \ t for tabs. The character \ itself also needs to be escaped, so \ escape result is;
- If you have a lot of line breaks, you can use three quotation marks, and then add a carriage return to complete the line-break input. For example:
- Not escaped: strings that use R ' ' to denote ' are not escaped by default. For example: R ' \\t\ ', the string content of the expression is: \\t\;
- Boolean value
Null value
Python: Data types and variables