Home  >  Article  >  Backend Development  >  The difference between python command line operation in win and Linux systems

The difference between python command line operation in win and Linux systems

WBOY
WBOYOriginal
2016-07-22 08:56:271824browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn