help(): information about Python modules, classes, functions, and keywords

help() provides us a built in document system in Python to explain us about the object. We can provide input argument about any specific object and get details about it.
help('print')
Output is here
Help on built-in function print in module builtins:

print(...)
    print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
    
    Prints the values to a stream, or to sys.stdout by default.
    Optional keyword arguments:
    file:  a file-like object (stream); defaults to the current sys.stdout.
    sep:   string inserted between values, default a space.
    end:   string appended after the last value, default a newline.
    flush: whether to forcibly flush the stream.
Try other functions.
help('dir')
Output
Help on built-in function dir in module builtins:

dir(...)
    dir([object]) -> list of strings
    
    If called without an argument, return the names in the current scope.
    Else, return an alphabetized list of names comprising (some of) the attributes
    of the given object, and of attributes reachable from it.
    If the object supplies a method named __dir__, it will be used; otherwise
    the default dir() logic is used and returns:
      for a module object: the module's attributes.
      for a class object:  its attributes, and recursively the attributes
        of its bases.
      for any other object: its attributes, its class's attributes, and
        recursively the attributes of its class's base classes.
Without any argument passed to help() we will get interpreter console and we can input any argument to get the details. We can close the console by entering quit at console.
help()
The console is here.
help>
We can get a list of available modules, keywords, symbols, or topics we can type "modules", "keywords", "symbols", or "topics".
help>  topics
A list of topics ( nearly 73 ) will be displayed. Any topic name can be entered to get details about the topics. Here is a list of available topics. Enter any topic name to get more help.
ASSERTIONDELETION LOOPING SHIFTING
ASSIGNMENT DICTIONARIES MAPPINGMETHODS SLICINGS
ATTRIBUTEMETHODS DICTIONARYLITERALS MAPPINGS SPECIALATTRIBUTES
ATTRIBUTES DYNAMICFEATURES METHODS SPECIALIDENTIFIERS
AUGMENTEDASSIGNMENT ELLIPSIS MODULES SPECIALMETHODS
BASICMETHODS EXCEPTIONS NAMESPACES STRINGMETHODS
BINARY EXECUTION NONE STRINGS
BITWISE EXPRESSIONS NUMBERMETHODS SUBSCRIPTS
BOOLEAN FLOAT NUMBERS TRACEBACKS
CALLABLEMETHODS FORMATTING OBJECTS TRUTHVALUE
CALLS FRAMEOBJECTS OPERATORS TUPLELITERALS
CLASSES FRAMES PACKAGES TUPLES
CODEOBJECTS FUNCTIONS POWER TYPEOBJECTS
COMPARISON IDENTIFIERS PRECEDENCE TYPES
COMPLEX IMPORTING PRIVATENAMES UNARY
CONDITIONAL INTEGER RETURNING UNICODE
CONTEXTMANAGERS LISTLITERALS SCOPING
CONVERSIONS LISTS SEQUENCEMETHODS
DEBUGGING LITERALS SEQUENCES

User defined Class

If user has defined its own class, then it should have its own help strings saying about the class. This is known as Docstrings.
About Docstrings used in class , module, function and methods

Using help() in Interactive Mode

If we call help() without any arguments, it enters an interactive help session. This mode allows us to browse through topics and get detailed documentation on modules, keywords, attributes, etc. We can exit the interactive help by typing "quit".
help()

Benefits of Using help()

  • Immediate Access to Documentation: It provides instant access to Python's documentation directly from the interpreter, making it easier to understand how to use various parts of the Python language and standard library.
  • Enhanced Learning: It's an excellent tool for learning and exploring Python, as we can explore new modules and functionalities interactively.
  • Debugging and Development Aid: It helps in debugging and development by offering quick references to function signatures and behavior.
In summary, the help() function is a valuable resource within Python, offering immediate access to comprehensive documentation and aiding in the exploration, learning, and debugging of Python code.
All Built in Functions in Python
max() Bitwise operators using format() int() float()


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer