ホームページ  >  記事  >  バックエンド開発  >  Python の組み込みヘルプ機能の詳細な紹介

Python の組み込みヘルプ機能の詳細な紹介

高洛峰
高洛峰オリジナル
2017-03-21 10:49:192291ブラウズ

英語ドキュメント:

ヘルプ([オブジェクト]) 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

組み込みのヘルプ システムを呼び出します (この関数は対話型での使用を目的としています)。引数が指定されていない場合、対話型ヘルプ システムは、引数が文字列の場合、モジュール、関数、クラス、メソッド、キーワード、またはドキュメント トピックの名前として検索され、コンソールにヘルプ ページが表示されます。引数が他の種類のオブジェクトの場合、そのオブジェクトに関するヘルプ ページが生成されます。

この関数は、site module.<p></p> <p><span style="color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"></span>指示: </p> <p></p> 1. インタプリタの対話型インターフェイスで、パラメータを渡さずに関数を呼び出すと、組み込みのヘルプ システムがアクティブになり、ヘルプ システムに入ります。ヘルプ システム内のモジュール、クラス、関数などの名前を入力すると、「quit」と入力して組み込みのヘルプ システムを終了し、対話型インターフェイスに戻ります。 🎜<pre class="brush:python;toolbar:false">&gt;&gt;&gt; help() #不带参数 Welcome to Python 3.5&amp;#39;s help utility! If this is your first time using Python, you should definitely check out the 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 writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type &quot;quit&quot;. To get a list of available modules, keywords, symbols, or topics, type &quot;modules&quot;, &quot;keywords&quot;, &quot;symbols&quot;, or &quot;topics&quot;. Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as &quot;spam&quot;, type &quot;modules spam&quot;. #进入内置帮助系统 &gt;&gt;&gt; 变成了 help&gt; help&gt; str #str的帮助信息 Help on class str in module builtins: class str(object) | str(object=&amp;#39;&amp;#39;) -&gt; str | str(bytes_or_buffer[, encoding[, errors]]) -&gt; 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 &amp;#39;strict&amp;#39;. | | Methods defined here: | | __add__(self, value, /) | Return self+value. ................................ help&gt; 1 #不存在的模块名、类名、函数名 No Python documentation found for &amp;#39;1&amp;#39;. Use help() to get the interactive help utility. Use help(str) for help on the str class. help&gt; 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 the interpreter, you can type &quot;help(object)&quot;. Executing &quot;help(&amp;#39;string&amp;#39;)&quot; has the same effect as typing a particular string at the help&gt; prompt. # 已退出内置帮助系统,返回交互界面 help&gt; 变成 &gt;&gt;&gt; &gt;&gt;&gt;</pre>🎜🎜2. インタプリタ対話型インターフェースでは、関数を呼び出すためにパラメータを渡すときに、パラメータがモジュール名、クラス名、関数名であるかどうかを確認し、そうである場合は、その使用方法が表示されます。 🎜🎜りー🎜🎜

以上がPython の組み込みヘルプ機能の詳細な紹介の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。