This article mainly introduces relevant information about Python escape characters in detail. Friends who need it can refer to
Python escape characters
When the special character is used in the character, python uses backslash (\) to escape the character. As shown in the following table:
OriginalString
Sometimes we don’t want the escape characters to take effect, we just want to display the original string means, this requires using r and R to define the original string. For example:
print r'\t\r'
The actual output is
“\t\r”
Description | |
---|---|
Line continuation character | |
Backslash symbol | |
Single Quotation marks | |
Double quotation marks | ##\a |
\b | |
\e | |
\000 | |
\n | |
\v | |
\t | |
\r | |
\f | |
\oyy | |
\xyy | |
\other | |
2. Python basic introductory tutorial
3. Geek Academy Python video tutorial
The above is the detailed content of Introducing how to use escape characters in Python in different scenarios. For more information, please follow other related articles on the PHP Chinese website!