ARTICLE AD BOX
I'm trying to make an interactive script for pydoc stuff, and some other informative introspection, like subclasses.
this works:
print(ArithmeticError.__subclasses__()) [<class 'FloatingPointError'>, <class 'OverflowError'>, <class 'ZeroDivisionError'>] print(type(ArithmeticError)) <class 'type'> print(ArithmeticError.__doc__) Base class for arithmetic errors.this does not work, with __doc__ only showing doc information for string.:
userinput = input("type a class.") print(type(userinput)) <class 'str'> print(userinput.__subclasses__()) AttributeError: 'str' object has no attribute 'subclasses'.
print(userinput.__doc__)
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) ->
str
Create a new string object from the given object. If encoding or
errors is specified, then the object must expose a data buffer that
will be decoded using the given encoding and error handler. Otherwise,
returns the result of object.str() (if defined) or repr(object).
encoding defaults to 'utf-8'. errors defaults to 'strict'.
How can I change a string back to a type, or maybe change a string back into a module, such as pandas?
