I think you need to inspect.getdoc.
Example:
>> print inspect.getdoc(list)
list() -> new empty list
list(iterable) -> new list initialized from iterable items
And for class methods:
>> print inspect.getdoc(str.replace)
S.replace(old, new[, count]) -> string
Return a copy of string S with all occurrences of substring
old replaced by new. If the optional argument count is
given, only the first count occurrences are replaced.
source
share