Python內建函數(29)——help,python內建29help

來源:互聯網
上載者:User

Python內建函數(29)——help,python內建29help

英文文檔:

help([object])

Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

This function is added to the built-in namespace by the site module.

 

說明:

  1. 在解譯器互動介面,不傳參數調用函數時,將啟用內建的協助系統,並進入協助系統。在協助系統內部輸入模組、類、函數等名稱時,將顯示其使用說明,輸入quit退出內建協助系統,並返回互動介面。

>>> help() #不帶參數Welcome to Python 3.5's help utility!If this is your first time using Python, you should definitely check outthe tutorial on the Internet at http://docs.python.org/3.5/tutorial/.Enter the name of any module, keyword, or topic to get help on writingPython programs and using Python modules.  To quit this help utility andreturn to the interpreter, just type "quit".To get a list of available modules, keywords, symbols, or topics, type"modules", "keywords", "symbols", or "topics".  Each module also comeswith a one-line summary of what it does; to list the modules whose nameor summary contain a given string such as "spam", type "modules spam".#進入內建協助系統  >>> 變成了 help>help> str #str的協助資訊Help on class str in module builtins:class str(object) |  str(object='') -> str |  str(bytes_or_buffer[, encoding[, errors]]) -> str |   |  Create a new string object from the given object. If encoding or |  errors is specified, then the object must expose a data buffer |  that will be decoded using the given encoding and error handler. |  Otherwise, returns the result of object.__str__() (if defined) |  or repr(object). |  encoding defaults to sys.getdefaultencoding(). |  errors defaults to 'strict'. |   |  Methods defined here: |   |  __add__(self, value, /) |      Return self+value. ................................help> 1 #不存在的模組名、類名、函數名No Python documentation found for '1'.Use help() to get the interactive help utility.Use help(str) for help on the str class.help> quit #退出內建協助系統You are now leaving help and returning to the Python interpreter.If you want to ask for help on a particular object directly from theinterpreter, you can type "help(object)".  Executing "help('string')"has the same effect as typing a particular string at the help> prompt.# 已退出內建協助系統,返回互動介面 help> 變成 >>>>>> 

  2. 在解譯器互動介面,傳入參數調用函數時,將尋找參數是否是模組名、類名、函數名,如果是將顯示其使用說明。

>>> help(str) Help on class str in module builtins:class str(object) |  str(object='') -> str |  str(bytes_or_buffer[, encoding[, errors]]) -> str |   |  Create a new string object from the given object. If encoding or |  errors is specified, then the object must expose a data buffer |  that will be decoded using the given encoding and error handler. |  Otherwise, returns the result of object.__str__() (if defined) |  or repr(object). |  encoding defaults to sys.getdefaultencoding(). |  errors defaults to 'strict'. |   |  Methods defined here: |   |  __add__(self, value, /) |      Return self+value. |    ***************************

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.