Introducing how to use escape characters in Python in different scenarios

Y2J
Release: 2017-05-04 13:47:58
Original
1573 people have browsed it

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'
Copy after login

The actual output is

“\t\r”
Copy after login

##Escape characterDescription\(at end of line)Line continuation character\\Backslash symbol\'Single Quotation marks ##\"##\aRing\bBackspace\eEscape\000Empty\nNewline\vVertical tab\tHorizontal tab\rBack Car\fPage change\oyyThe character represented by the octal number yy, for example : \o12 represents a new line \xyyThe character represented by the decimal number yy, for example: \x0a represents a new line \otherOther characters are output in normal format##[Related recommendations]
Double quotation marks

1. Python free online video tutorial

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!