我想知道是否有像'man.py'專用於Python的CLI?python有沒有'男人'?
前,
man.py os.system
> system(command) -> exit_status
>
> Execute the command (a string) in a subshell.
我想知道是否有像'man.py'專用於Python的CLI?python有沒有'男人'?
前,
man.py os.system
> system(command) -> exit_status
>
> Execute the command (a string) in a subshell.
使用在殼pydoc function
,最簡單的方法與function
是一個內置的名稱或功能的一個模塊中的合格域名(module.function
):
> PAGER=cat pydoc urllib.urlencode
[[email protected]:~]> PAGER=cat pydoc urllib.urlencode
Help on function urlencode in urllib:
urllib.urlencode = urlencode(query, doseq=0)
Encode a sequence of two-element tuples or dictionary into a URL query string.
...
(PAGER=cat
只用來使它複製到這裏& pastable)
使用IPython時,可以使用function?
來查看function
或function??
的文檔字符串以獲取更詳細的視圖,其中包含用python編寫的函數的完整源代碼。
在普通的python shell中,你可以使用help(function)
來做到這一點。但在我看來,IPython的方式更加舒適。
的是pydoc模塊提供它:?
$ python -m pydoc os.system
Help on built-in function system in os:
os.system = system(...)
system(command) -> exit_status
Execute the command (a string) in a subshell.
$
是在/ usr/bin中。 –
1爲提IPython的 – Levon
或'function'其等於''功能是pydoc – Vidul