Home  >  Article  >  Backend Development  >  How to view python source code

How to view python source code

(*-*)浩
(*-*)浩Original
2019-07-01 09:20:1617969browse

As we all know, Python has many built-in function modules, and we may also install many third-party modules and so on.

To check which modules are installed, you can enter pip list on the command line (you must first configure the python environment variables).

How to view python source code

Let’s take getpass as an example to view its source code. (Recommended learning: Python video tutorial)

1.help(getpass)

Enter this command to find the file path, and you can view its other Features provided.

2. Use getpass.__file__ to check the location

Finally find the file and open it with Notepad or other editor.

3.PyCharm Editor

Hold down the "ctr left mouse button" on the class or method to quickly view the source code.

4.dir(object name)

This method can quickly check what methods are available.

If you want to see the explanation of each function, use help(type(object name))

5. Check the API

This should go without saying Everyone can use it.

Give me an API download link: http://pan.baidu.com/s/1qYx6BPa

If you have problems opening chm, you can click on this link to have a look: https://jingyan. baidu.com/article/a948d65145f6ad0a2dcd2eae.html

These APIs have been collected by me for a long time. I hope they will be helpful to everyone if I share them.

6. View on the Internet

Recommended URL: https://github.com/python/cpython/tree/3.5/Modules

More For many Python related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of How to view python source code. For more information, please follow other related articles on the PHP Chinese website!

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