[英]How to print an 'Apostrophe' from a Python print line using Sphinx and reStructuredText?
I want to write a documentation with Sphinx using reStructuredText.我想使用 reStructuredText 用 Sphinx 编写文档。
In my documentation I want to add this line of python code, which uses an apostrophe after the name jack.在我的文档中,我想添加这行 python 代码,它在名称 jack 后使用撇号。 This apostrophe is escaped by a backslash in Python:
这个撇号在 Python 中被反斜杠转义:
print('I am jack\'s raging bile duct')
When I add this to a reStructuredText (rst) file like this:当我将其添加到 reStructuredText (rst) 文件时,如下所示:
This is a simple example:
::
print('I am jack\'s raging bile duct')
after compiling to a html file I will see this:编译成 html 文件后,我会看到:
How can I get rid of the backslash \\ in my rst/Sphinx output html and still use the aposthrophe after jack and ' ?如何在我的 rst/Sphinx 输出 html 中去掉反斜杠 \\ 并在 jack 和 ' 之后仍然使用撇号?
您可以使用双引号
print("I am jack's raging bile duct")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.