Tuesday, May 15, 2018

Python : Access Your Own Docstring

You have a function in a file and you want to view the docstring. You're in the python shell. What's the quickest way?

> Cheat - assume you're in the same directory :)

>>> from basename import * # file is basename.py
>>> func_name.__doc__     # will show it to you

No comments: