You can use or print . prints a more detailed description of the object, and contains only the line of documentation that you defined with triple quotes at the beginning of your function. help()__doc__help()__doc__""" """
For example, using __doc__explicitly in a built-in function sum:
print(sum.__doc__)
Return the sum of a 'start' value (default: 0) plus an iterable of numbers
When the iterable is empty, return the start value.
This function is intended specifically for use with numeric values and may
reject non-numeric types.
, Python , , __doc__ :
def foo():
"""sample doc"""
print(foo.__doc__)
foo()
, __doc__, .
, help() sum:
help(sum)
:
Help on built-in function sum in module builtins:
sum(iterable, start=0, /)
Return the sum of a 'start' value (default: 0) plus an iterable of numbers
When the iterable is empty, return the start value.
This function is intended specifically for use with numeric values and may
reject non-numeric types.
, docstring.