In this Article we’ll go through the Python help Function and how to use it.

When you download python into your PC, many helpful tools and built-in functions accompany it. One of these helpful features is the python documentation. The Python help() function provides an easy and internet free way to access the documentation for a specific function, keyword, class or module.


Syntax

help(function/module/keyword)

If you come across a module or function who’s syntax you’re looking for, or maybe the input parameter’s it takes. Simply type that module or function into the help() function. Fair warning, the documentation of the average module is well over 100 lines.

Let’s try an example here.

help(help)

Yes, we just called the documentation for the help function. Here’s the output. (Not very useful, since help has no parameters or functions that the documentation might explain)

Help on _Helper in module _sitebuiltins object:

class _Helper(builtins.object)
 |  Define the builtin 'help'.
 |  
 |  This is a wrapper around pydoc.help that provides a helpful message
 |  when 'help' is typed at the Python interactive prompt.
 |  
 |  Calling help() at the Python prompt starts an interactive help session.
 |  Calling help(thing) prints help for the python object 'thing'.
 |  
 |  Methods defined here:
 |  
 |  __call__(self, *args, **kwds)
 |      Call self as a function.
 |  
 |  __repr__(self)
 |      Return repr(self).
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)

Try some other commands like

help(print)
help(max)
help(len)

This marks the end of the Python help Function. Any suggestions or contributions for CodersLegacy are more than welcome. Questions can be asked in the comment section below.

Here’s a link back to the main Python Built-in Functions page.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments