Help mode

Python has a feature that can provide you with information about a particular topic or command. It is called the help mode and can be started in the interactive mode by typing help ():

C:\Python34\Scripts>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help ()

Welcome to Python 3.4'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.4/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 "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics". 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 "spam", type "modules spam".

help>

The text displayed above expains how to use the help mode. For example, to see a list of topics available, enter the topics keyword:

help> topics

Here is a list of available topics. Enter any topic name to get more help.

ASSERTION - DELETION - 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

help>

If you want to display more information about a particular topic, simply type the name of the topic and press Enter. For example, to found out more about the topic NUMBERS, enter the NUMBERS keyword (make sure to type the word in uppercase):

help> NUMBERS
Numeric literals
****************

There are three types of numeric literals: integers, floating point
numbers, and imaginary numbers. There are no complex literals
(complex numbers can be formed by adding a real number and an
imaginary number).

Note that numeric literals do not include a sign; a phrase like "-1"
is actually an expression composed of the unary operator '"-"' and the
literal "1".

Related help topics: INTEGER, FLOAT, COMPLEX, TYPES

help>

The help mode can be useful if you encounter some code you don’t know the purpose of. For example, to find out what sys.platform means, type it inside the help mode:

help> sys.platform
Help on str in sys object:

sys.platform = 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'.
.
.
.
.
.

To leave the help mode, press Enter once. You probably won’t use this Help mode very often – there are plenty of good books on Python and quality internet websites and discussion forum (e.g. Stack Overlow) where you will find solutions to your problems.

Geek University 2022