I am trying to load the help on each method into a QTextEdit in PyQt4
how can I have this variable hold help on a method, example:data = os.system('python -c "import sys; help(sys.path)"')
but data value contains 0
I am trying to load the help on each method into a QTextEdit in PyQt4
how can I have this variable hold help on a method, example:data = os.system('python -c "import sys; help(sys.path)"')
but data value contains 0
got some success but the text is not properly formatted any help would be appreciated
data = os.popen('python -c "import sys; help(sys.path)"').read()
now data stores value like the below but not formatted..
'"Help on list object:\\n\\nclass list(object)\\n | list() -> new empty list\\n | list(iterable) -> new list initialized from iterable\'s items\\n | \\n | Methods defined here:\\n | \\n | __add__(...)\\n | x.__add__(y) <==> x+y\\n | \\n | __contains__(...)\\n | x.__contains__(y) <==> y in x\\n | \\n | __delitem__(...)\\n | x.__delitem__(y) <==> del x[y]\\n | \\n | __delslice__(...)\\n | x.__delslice__(i, j) <==> del x[i:j]\\n | \\n | Use of negative indices is not supported.\\n | \\n | __eq__(...)\\n | x.__eq__(y) <==> x==y\\n | \\n | __ge__(...)\\n | x.__ge__(y) <==> x>=y\\n | \\n | __getattribute__(...)\\n | x.__getattribute__(\'name\') <==> x.name\\n | \\n | __getitem__(...)\\n | x.__getitem__(y) <==> x[y]\\n | \\n | __getslice__(...)\\n | x.__getslice__(i, j) <==> x[i:j]\\n | \\n | Use of negative indices is not supported.\\n | \\n | __gt__(...)\\n | x.__gt__(y) <==> x>y\\n | \\n | __iadd__(...)\\n | x.__iadd__(y) <==> x+=y\\n | \\n | __imul__(...)\\n | x.__imul__(y) <==> x*=y\\n | \\n | __init__(...)\\n | x.__init__(...) initializes x; see help(type(x)) for signature\\n | \\n | __iter__(...)\\n | x.__iter__() <==> iter(x)\\n | \\n | __le__(...)\\n | x.__le__(y) <==> x<=y\\n | \\n | __len__(...)\\n | x.__len__() <==> len(x)\\n | \\n | __lt__(...)\\n | x.__lt__(y) <==> x<y\\n | \\n | __mul__(...)\\n | x.__mul__(n) <==> x*n\\n | \\n | __ne__(...)\\n | x.__ne__(y) <==> x!=y\\n | \\n | __repr__(...)\\n | x.__repr__() <==> repr(x)\\n | \\n | __reversed__(...)\\n | L.__reversed__() -- return a reverse iterator over the list\\n | \\n | __rmul__(...)\\n | x.__rmul__(n) <==> n*x\\n | \\n | __setitem__(...)\\n | x.__setitem__(i, y) <==> x[i]=y\\n | \\n | __setslice__(...)\\n | x.__setslice__(i, j, y) <==> x[i:j]=y\\n | \\n | Use of negative indices is not supported.\\n | \\n | __sizeof__(...)\\n | L.__sizeof__() -- size of L in memory, in bytes\\n | \\n | append(...)\\n | L.append(object) -- append object to end\\n | \\n | count(...)\\n | L.count(value) -> integer -- return number of occurrences of value\\n | \\n | extend(...)\\n | L.extend(iterable) -- extend list by appending elements from the iterable\\n | \\n | index(...)\\n | L.index(value, [start, [stop]]) -> integer -- return first index of value.\\n | Raises ValueError if the value is not present.\\n | \\n | insert(...)\\n | L.insert(index, object) -- insert object before index\\n | \\n | pop(...)\\n | L.pop([index]) -> item -- remove and return item at index (default last).\\n | Raises IndexError if list is empty or index is out of range.\\n | \\n | remove(...)\\n | L.remove(value) -- remove first occurrence of value.\\n | Raises ValueError if the value is not present.\\n | \\n | reverse(...)\\n | L.reverse() -- reverse *IN PLACE*\\n | \\n | sort(...)\\n | L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;\\n | cmp(x, y) -> -1, 0, 1\\n | \\n | ----------------------------------------------------------------------\\n | Data and other attributes defined here:\\n | \\n | __hash__ = None\\n | \\n | __new__ = <built-in method __new__ of type object>\\n | T.__new__(S, ...) -> a new object with type S, a subtype of T\\n\\n"'
is this possible to do how I am trying to do
def outputHelp(self):
### module ###
module = ""
items = self.searchListView.selectedIndexes()
for item in items:
module = str(item.data().toString()).split(":")[0]
method = ""
items = self.methodListView.selectedIndexes()
for selItem in items:
method = str(selItem.data().toString())
__import__(module)#,globals={}, locals={}, fromlist=[], level=-1)
# self.methodListView.
data = os.popen('python -c "help('+module.method+')"').read()
figured out using tmpFile.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.