Today, I am completing a small python exercise. The main content of the exercise is to read a help module and save it to a local file.
I know that pydoc is used to read the module, but under the windows system, after calling the os module, the result is always empty.
Core statement:
helpfile = os.popen('pydoc %s' %module).read()
This statement can run normally under Linux and the result is normal.
It was later discovered that under Windows, the modification is:
helpfile = os.popen('python -m pydoc %s' %module).read()
Command line operation requires the use of Windows command line statements.
The above is the entire content of this article, I hope it will be helpful to everyone learning Python