在終端上輸入pydoc會顯示以下信息
pydoc - the Python documentation tool
pydoc <name> ...
Show text documentation on something. <name> may be the name of a
Python keyword, topic, function, module, or package, or a dotted
reference to a class or function within a module or module in a
package. If <name> contains a '/', it is used as the path to a
Python source file to document. If name is 'keywords', 'topics',
or 'modules', a listing of these things is displayed.
pydoc -k <keyword>
Search for a keyword in the synopsis lines of all available modules.
pydoc -p <port>
Start an HTTP server on the given port on the local machine. Port
number 0 can be used to get an arbitrary unused port.
pydoc -b
Start an HTTP server on an arbitrary unused port and open a Web browser
to interactively browse documentation. The -p option can be used with
the -b option to explicitly specify the server port.
pydoc -w <name> ...
Write out the HTML documentation for a module to a file in the current
directory. If <name> contains a '/', it is treated as a filename; if
it names a directory, documentation is written for all the contents.
pydoc是python自帶的一個文檔生成工具,使用pydoc可以很方便的查看類和方法結構
python中pydoc模塊可以從python代碼中獲取docstring,然后生成幫助信息。
pydoc是Python自帶的模塊,主要用於從python模塊中自動生成文檔,這些文檔可以基於文本呈現的、也可以生成WEB 頁面的,還可以在服務器上以瀏覽器的方式呈現!
python -m pydoc -p 1234 在本地機器上,按照給定的端口啟動HTTP
一、查看文檔的方法
方法1:啟動本地服務,在web上查看文檔

方法2:直接查看某個py文件的內容

方法三:生成html說明文檔

方法四:-k查找模塊
二、html文檔說明
第一部分:模塊的文檔說明,展示模塊頂部的多行注釋

第二部分:classes,展示class以及class下的function

第三部分:function,模塊下的def方法,不是class中的方法

第四部分:data,模塊下直接定義的變量,不是function或class的變量

@author 每天1990
@desc 本模塊是一個測試文件,用來說明pydoc的讀取內容
@date 2017/4/13
說明:
classes:testclass(),具有function1()和function2()兩個方法
function:test1(),test2(),test3()
Data:a,b
"""
#注釋放在方法名前,使用#號注釋
def test1(a):
print("注釋放在方法名前")
#注釋放在方法名前,使用#號注釋
def test2():
"""
注釋放在方法內的第一行,既有#號又有多行注釋時,優先展示多行注釋
"""
print("既有#號又有多行注釋時,優先展示多行注釋 ")
def test3():
#在方法第一行內使用#注釋
print("在方法內使用#號注釋,不生效")
class testclass():
"""
注釋生效順序與方法一致,優先展示類下的多行注釋,如果沒有才展示類上面的#號注釋
類下的方法的注釋不會展示出來
"""
def function1(self):#類下方法的注釋不會展示
print("類下的第一個方法")
def function2(self,a):
print("類下的第二個參數,包含a參數")
a=1#變量的注釋不會展示出來
b=2
三、注釋方法
python的注釋方法有兩種:
單引號進行多行注釋
pydoc注釋展示策略:



