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, attribu
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) -> in
Jim Mooney Py3.4.3winXP wrote:
> On 19 May 2015 at 17:25, Jim Mooney Py3.4.3winXP
> 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 a
On 19 May 2015 at 17:25, Jim Mooney Py3.4.3winXP
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.
--
Jim
After not doing
On 19 May 2015 at 17:18, Ben Finney 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 importlib
>>> impo
"Jim Mooney Py3.4.3winXP" 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 this to work::
>>>