Python Module Tutorial

Source: Internet
Author: User
First, the module classification:
1. Standard library module: Python comes with, directly using the import can be used directly;
2. Third-party library: External use, need to download first (pip install module_name)
3. Program Customization Module: The module of its own definition

Second, the process of module call (import)
1. First execute the code of the module;
2. The module is then used as a variable for the caller;

Iii. introduction of various import methods

Iv. the order in which to search for file paths when importing modules
1. First search the folder path where the current execution file is located, you can use Sys.path to view the current path;

2. Therefore, if the imported module does not belong to the current executable file under the folder, you can use the Append function, now the imported file belongs to the folder to join the Sys.path,

Or

3. In Summary, we in the actual use, the import should be the final run the entire program of the file belongs to the folder, do not use the debugging process of a certain PY file path as the basis to import;

Python Module Tutorial

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.