On 20 May 2015 at 01:02, Peter Otten __pete...@web.de wrote:
If you start with an object dir() gives you a list of attribute names. To
get the actual attributes use
attribute = getattr(object, attribute_name)
Then print the attributes' docstring with
print(attribute_name,
On 20/05/15 09:02, Peter Otten wrote:
$ python3 -i shorthelp.py
shorthelp(whatever)
No module named 'whatever'
shorthelp(42)
int(x=0) - integer
---
bit_length int.bit_length() - int
conjugateReturns self, the complex conjugate of any int.
denominator int(x=0) -
Jim Mooney Py3.4.3winXP wrote:
On 19 May 2015 at 17:25, Jim Mooney Py3.4.3winXP
cybervigila...@gmail.com wrote:
If I can get dir to accept x I can parse the output to get rid of the
__xxx stuff and print it out.
By that I mean dir will give me a list of strings I can then use __doc__
I use python help() a good deal but get tired of paging through the
__object__ stuff to get to what I use at my level, so I wrote the following
to omit it. The problem is, I want to import it then use it as shorthelp.py
for different modules so I could just type shorthelp(modulename). Only the
Jim Mooney Py3.4.3winXP cybervigila...@gmail.com writes:
I can only use the hardcoded imported module name, shutil in this
case. If I try x = anothermodule, then import x, it doesn't work.
Can you show an example of Python code that you would like to work?
I am *guessing* you mean you want
On 19 May 2015 at 17:18, Ben Finney ben+pyt...@benfinney.id.au wrote:
You will be pleased to know of the standard library ‘importlib’
library::
import importlib
Yes, I already got importlib to accept a string. But I can't figure how to
get dir to accept it:
x = 'shutil'
import
On 19 May 2015 at 17:25, Jim Mooney Py3.4.3winXP cybervigila...@gmail.com
wrote:
If I can get dir to accept x I can parse the output to get rid of the
__xxx stuff and print it out.
By that I mean dir will give me a list of strings I can then use __doc__ on
to get all useful help items.
--