Home >Backend Development >Python Tutorial >How to enter backslash in python

How to enter backslash in python

silencement
silencementOriginal
2019-05-16 16:29:2618766browse

Through the previous study, we have mastered how to output single quotes in Python: two solutions, one is to put the single quotes within double quotes; the other is to use escape characters, that is, \. What should I do if I want to output backslashes?

How to enter backslash in python

##Output backslashes in Python:

For example, to output the three characters Bob, Lucy, and Mary names, and they are separated by \, we can do this:

How to enter backslash in python

The output result is exactly what we want! Here we also use the escape character \, and its output result is \. In this example, the first \ will escape the second \!

Look at another example

How to enter backslash in python

The result is directly output\.


The following are commonly used escape characters and their meanings

How to enter backslash in python

The above is the detailed content of How to enter backslash in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:How to learn python wellNext article:How to learn python well