How to obtain man page contents in Python?

linux, manpage, python, subprocess

Solution

Try:

p = subprocess.Popen(('man -P cat %s' % manTopic,), shell = True)
stdout, stderr = p.communicate()
if stdout:

instead -- the "-P" option overrides the pager program used by the "man" command.

Problem

im running linux and i want to import some man pages to my application. i came up with this: ``` p = subprocess.Popen(('man %s' % manTopic,), shell = True, stdout = subprocess.PIPE) stdout, stderr = p.communicate() if stdout: ``` but its no good, man is displaying only first page and blocks my applicationon How can i obtain man page with Python?

Original source