सभी फंक्शन्स में एक बिल्ट-इन एट्रिब्यूट __doc__ होता है, जो फंक्शन सोर्स कोड में परिभाषित डॉक स्ट्रिंग लौटाता है।
def foo():
""" This is an example of how a doc_string looks like.
This string gives useful information about the function being defined.
"""
pass
print(foo.__doc__)
आइए देखें कि जब हम इसे प्रिंट करते हैं तो यह कैसा दिखेगा:
This is an example of how a doc_string looks like.
This string gives useful information about the function being defined.