Adarsh Maurya
Adarsh Maurya

Reputation: 358

Is it possible to read Doc Strings of a Python file w/o using python shell?

I was wondering if there is any way we can read doc strings present in a python file from command line, prior to importing it, or w/o using any Ipython or Python kernel, just like 'man' command does.

Upvotes: 2

Views: 116

Answers (1)

Gerrat
Gerrat

Reputation: 29690

You can execute some python code from the command line, so given a module named my_module.py, and a function named my_function, the following:

python -c "from my_module import my_function;print my_function.__doc__"

will print out the docstring

Upvotes: 1

Related Questions