In Windows and Linux, the python command line runs differently.

Source: Internet
Author: User

In Windows and Linux, the python command line runs differently.

Today, after completing a small python exercise, the main content of the exercise is to read a help module and save it to a local file.

It is known that pydoc is used to read the module, but in windows, the result is always blank after the OS module is called.

Core Statement:

Helpfile = OS. popen ('pydoc % s' % module). read ()

This statement runs normally in Linux and the result is normal.

Later it was found that in Windows, the modification was as follows:

Helpfile = OS. popen ('python-m pydoc % s' % module). read ()

To run the command line, use the command line Statement of Windows.

The above is all the content of this article, hoping to help you learn Python

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.