Reputation: 358
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
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