Python Comments Documentation || __doc__ || Special Variable || Python
In this we are going to see a basic use of an attribute __doc__ of special variables in Python Programming Language.



# __doc__ will print out the docstring that appears in a class or method. A docstring is a string comment and is the first line after the class or method header

class MyClass:
    "This is a test"

    def __init__(self):
        pass


print(MyClass.__doc__)


def myfunction():
    "This is a test inside of a function"
    pass


print(myfunction.__doc__)

# Coded By DHIRAJ SHELKE


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post