为什么从包含问号的第一个文件转换而来的html文件在单击目录时无法显示在浏览器上?

问题描述 投票:1回答:1

我构建了一个python文档生成器-sphinx,当我用firefox单击第11篇文章http://127.0.0.1/build/html/python/Using%20iloc,%20loc,%20&%20ix%20to%20select%20rows%20and%20columns%20in%20Pandas%20DataFrames.html时,放一些文章,如下所示:

enter image description here

然后单击目录:12.What does "_" in python mean in a for-loop,Firefox跳入http://127.0.0.1/build/html/python/What%20does%20%22_%22%20in%20Python%20mean%20in%20a%20for-loop?.html,如下所示:

enter image description here

事实上,网页What does "_" in Python mean in a for-loop?.html位于目录build/html/python中。

ls  build/html/python | grep  What
What does "_" in Python mean in a for-loop?.html

为什么单击目录时不能显示网页?enter image description here

如果我手动输入网址,则>

http://127.0.0.1/build/html/python/What%20does%20%22_%22%20in%20Python%20mean%20in%20a%20for-loop%3f.html

可以毫无问题地显示网页。enter image description here

为什么

http://127.0.0.1/build/html/python/What%20does%20%22_%22%20in%20Python%20mean%20in%20a%20for-loop?.html

无法解析为

http://127.0.0.1/build/html/python/What%20does%20%22_%22%20in%20Python%20mean%20in%20a%20for-loop%3f.html

通过sphinx系统何时单击目录?是否是狮身人面像的错误?如何解决?

第一个文件

What does "_" in Python mean in a for-loop?
=================================================
It’s generally an indication that you don’t care about the current value of the variable.

For example, you might have:

    for i in range (1, 11):
        print(i)

In the case above, we clearly want to use i in our code.

However, in the following case:

    for i in range (1, 11):
      print(“Hello”)

The i is not used. We indicate this by using _ instead:

    for _ in range (1, 11):
      print(“Hello”)

This is not required; it is just idiomatic. It is also useful while debugging, as you know that you didn’t use _ anywhere in the loop.

While this:

    for _ in range (1, 11):
        print(_)

will work just as it did with i, it is bad practice at best and can be extremely confusing in more complex examples.

以上第一个文件在make html之后的html文件部分。

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>12. What does “_” in Python mean in a for-loop? &#8212; documents 1 documentation</title>
    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="13. install opencv on debian" href="install opencv on debian.html" />
    <link rel="prev" title="11. Using iloc, loc, &amp; ix to select rows and columns in Pandas DataFrames" href="Using iloc, loc, &amp; ix to select rows and columns in Pandas DataFrames.html" />

  <link rel="stylesheet" href="../_static/custom.css" type="text/css" />


  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head>

如果我将源文件名What does "_" in Python mean in a for-loop?.rst更改为What does "_" in Python mean in a for-loop.rst,也就是说,在第一个文件名中删除?,则单击目录将跳至http://127.0.0.1/build/html/python/What%20does%20%22_%22%20in%20Python%20mean%20in%20a%20for-loop.htmlWhat does "_" in Python mean in a for-loop.rst中的内容显示完美,为什么文件名不能包含?,例如What does "_" in Python mean in a for-loop?.rst。为什么第一个文件名中不能包含??如askaroni所说,与代码块指令无关。

[我构建了一个python文档生成器-sphinx,当我单击第11篇文章http://127.0.0.1/build/html/python/Using%20iloc,%20loc,%20&%20ix%时,在其中添加一些文章20to%20select%20rows%20and%...

python python-sphinx
1个回答
0
投票

[?最近被用作通配符,用于URL中的部分单词匹配,因此将被当作特殊字符处理。

© www.soinside.com 2019 - 2024. All rights reserved.