Python docstrings are the string literals enclosed in triple quotes that appear right after the definition of a function, method, class, or module. These are generally used to describe the functionality of a particular function, method, class, or module. We can access these docstrings using the __doc__ attribute. Here is an example:
def square(n):
'''Takes in a number n, returns the square of n'''
return n**2
print(square.__doc__)
Ouput: Takes in a number n, returns the square of n