简体   繁体   中英

How to print an 'Apostrophe' from a Python print line using Sphinx and reStructuredText?

I want to write a documentation with Sphinx using reStructuredText.

In my documentation I want to add this line of python code, which uses an apostrophe after the name jack. This apostrophe is escaped by a backslash in Python:

print('I am jack\'s raging bile duct')

When I add this to a reStructuredText (rst) file like this:

This is a simple example:
::

print('I am jack\'s raging bile duct')

after compiling to a html file I will see this:

在此处输入图片说明

How can I get rid of the backslash \\ in my rst/Sphinx output html and still use the aposthrophe after jack and ' ?

您可以使用双引号

print("I am jack's raging bile duct")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM