{"id":6081,"date":"2020-05-28T12:31:59","date_gmt":"2020-05-28T12:31:59","guid":{"rendered":"https:\/\/www.askpython.com\/?p=6081"},"modified":"2022-08-06T13:28:47","modified_gmt":"2022-08-06T13:28:47","slug":"python-help-method","status":"publish","type":"post","link":"https:\/\/www.askpython.com\/python\/built-in-methods\/python-help-method","title":{"rendered":"Python help() method"},"content":{"rendered":"\n<p>Hey, folks! In this article, we will be focusing on a important explanatory function in Python &#8212; <strong>Python help() function<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Need of the help() method<\/h2>\n\n\n\n<p>While coding in a particular programming language, it is very essential for us to know the basic documentation of the framed language. This is when the help() function comes into picture. <\/p>\n\n\n\n<p>This function provides us with the basic documentation of <a href=\"https:\/\/www.askpython.com\/python\" class=\"rank-math-link\">Python <\/a>language. It gives us the information about the methods and instances associated with a particular method or class.<\/p>\n\n\n\n<p>The help() method works with keywords, Classes, functions and modules to help us gain the basic terminologies, instances and working attached with it respectively.<\/p>\n\n\n\n<p>Usually the <code>help() method<\/code> is used alongside the <strong>Python interpreter<\/strong> to gain access to the underlying details about Python objects passed to it as a parameter.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Working of Python help() method<\/h2>\n\n\n\n<p>As mentioned above, the help() method provides information about the Python objects passed to it.<\/p>\n\n\n\n<p>If the<code> help() function<\/code> is mentioned without any parameter, it starts the interpreter console wherein we can mention any <strong>module<\/strong>, <strong>objects<\/strong>, <strong>class<\/strong>, etc to<strong><em> avail the documentation<\/em><\/strong> about the same.<\/p>\n\n\n\n<p><strong>Example :<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp()\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1074\" height=\"473\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help.png\" alt=\"Python Help\" class=\"wp-image-6087\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help.png 1074w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-300x132.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-1024x451.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-768x338.png 768w\" sizes=\"auto, (max-width: 1074px) 100vw, 1074px\" \/><figcaption><strong>help() function<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Python help() function with a Class<\/h3>\n\n\n\n<p>The help function can be feeded with customized or pre-defined parameters to work with. We can create a customized class and pass it to the help() function to examine the documentation provided by the function.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nclass Info:\n    lang = &quot;Python&quot;\n    name = &quot;JournalDev&quot;\nobj = Info()\nhelp(Info)\n<\/pre><\/div>\n\n\n<p>We have created an user-defined class and passed it to the help() function. The help() function has returned the necessary documentation of the class &#8216;Info&#8217;.<\/p>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nHelp on class Info in module __main__:\n\nclass Info(builtins.object)\n |  Data descriptors defined here:\n |  \n |  __dict__\n |      dictionary for instance variables (if defined)\n |  \n |  __weakref__\n |      list of weak references to the object (if defined)\n |  \n |  ----------------------------------------------------------------------\n |  Data and other attributes defined here:\n |  \n |  lang = &#039;Python&#039;\n |  \n |  name = &#039;JournalDev&#039;\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Python help() function with a function<\/h3>\n\n\n\n<p>The help() function helps us to access the syntax, parameter list and the description about any function passed to it using the below command.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp(&#039;function-name&#039;)\n<\/pre><\/div>\n\n\n<p><strong>Example 1:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp(&#039;getattr&#039;)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"207\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-function-getatr.png\" alt=\"Python help() Function With Function getattr()\" class=\"wp-image-6094\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-function-getatr.png 786w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-function-getatr-300x79.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-function-getatr-768x202.png 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><figcaption><strong>help() With Function getattr()<\/strong><\/figcaption><\/figure>\n\n\n\n<p><strong>Example 2:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp(&#039;map&#039;)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"847\" height=\"524\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-function-map.png\" alt=\"Python help() Function With Function map()\" class=\"wp-image-6097\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-function-map.png 847w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-function-map-300x186.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-function-map-768x475.png 768w\" sizes=\"auto, (max-width: 847px) 100vw, 847px\" \/><figcaption><strong>help() With Function map()<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Python help() function with a module<\/h3>\n\n\n\n<p>We can gain information about the module using the help() function. When a module is passed to the help() function, it provides the documentation in terms of the version, file location, contents of the module, and data associated with it.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp(&#039;module-name&#039;)\n<\/pre><\/div>\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp(&#039;seaborn&#039;)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1119\" height=\"757\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Module-Seaborn.png\" alt=\"Python help() Function With Module Seaborn\" class=\"wp-image-6093\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Module-Seaborn.png 1119w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Module-Seaborn-300x203.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Module-Seaborn-1024x693.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Module-Seaborn-768x520.png 768w\" sizes=\"auto, (max-width: 1119px) 100vw, 1119px\" \/><figcaption><strong>Help on Module Seaborn<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"> The help() function with a keyword<\/h3>\n\n\n\n<p>On passing a Python keyword as parameter to the help() function, the function returns the documentation in terms of the class of the keyword, the methods associated with it, etc.<\/p>\n\n\n\n<p><strong>Syntax:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp(&#039;keyword-name&#039;)\n<\/pre><\/div>\n\n\n<p><strong>Example 1:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp(True)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1036\" height=\"703\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-True.png\" alt=\"Python help() Function With Keyword True\" class=\"wp-image-6089\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-True.png 1036w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-True-300x204.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-True-1024x695.png 1024w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-True-768x521.png 768w\" sizes=\"auto, (max-width: 1036px) 100vw, 1036px\" \/><figcaption><strong>help() function With Keyword True<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p><strong>Example 2:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nhelp(int)\n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"703\" src=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-int.png\" alt=\"Python help() Function With Keyword int\" class=\"wp-image-6091\" srcset=\"https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-int.png 910w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-int-300x232.png 300w, https:\/\/www.askpython.com\/wp-content\/uploads\/2020\/05\/Python-help-function-with-Keyword-int-768x593.png 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><figcaption><strong>help() Function With Keyword int<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>By this we have come to the end of this topic. We have understood the need and working of the help() function. I hope this concept is clear to all the readers. <\/p>\n\n\n\n<p>Please feel free to comment, in case you happen to come across any doubt.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">References<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>help() method &#8212; JournalDev<\/li><li><a href=\"https:\/\/docs.python.org\/3\/library\/functions.html#help\" class=\"rank-math-link\" target=\"_blank\" rel=\"noopener\">Documentation on help() method<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Hey, folks! In this article, we will be focusing on a important explanatory function in Python &#8212; Python help() function. Need of the help() method While coding in a particular programming language, it is very essential for us to know the basic documentation of the framed language. This is when the help() function comes into [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":6141,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-6081","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-built-in-methods"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts\/6081","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/comments?post=6081"}],"version-history":[{"count":0,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/posts\/6081\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/media\/6141"}],"wp:attachment":[{"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/media?parent=6081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/categories?post=6081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.askpython.com\/wp-json\/wp\/v2\/tags?post=6081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}