String
1. Common sense of strings
Strings are similar to numbers and both have types. The string type is str. In Python, double quotes "" or single quotes" are used to indicate that the content inside is a string.
1.1 String
The function of the escape character (\) is to escape: let a character not express a special meaning, but a specific meaning.
Analysis: \'representation'
analysis:
- digit 1: Represents a string object
- digit 2: output the string content in the standard output file
1.2 Variables and strings
type() is used to view the similarity of the object bound to the variable, not the type of the variable itself. The variable has no type, and the object has a type.
1.3 String splicing
Automatic splicing can be realized between character strings and character strings.
str : It is a string type , which can realize type conversion and convert a non-string type into a string type.
repr : convert a non-string to a string