Python3 module, package call & Path details, python3 module package call

Source: Internet
Author: User

Python3 module, package call & Path details, python3 module package call

As follows:

The following code is used to explain the advantages of the ''''' Infi_chu ''' module in the blog Park: 1. high maintainability 2. there are three modules that can greatly reduce the amount of code written: 1. python standard library 2. third-party Module 3. application custom module ''' # import example # Call example Module # from example import example # Call an example method ''' Infi_chu ''' In the example module '''''' package features: 1. there are _ init __. py file 2. there are many modules consisting of ''' # from test import example # test is the package name, example Module name, a layer of nesting # from test. test1 import example # test1 and test2 are both package names. test1 is in test, and example is the module name # from test. test1.func1 import example # func1 is a func1 method in the example Module # import test # test indicates the package name, this command is equivalent to executing the _ init _ file '''blog Infi_chu ''''' import package or the difference between modules. The import package only executes a _ init __. the py file is not associated with other modules. to call the import module, call the ''''' path of the module to solve ''' # import sys, OS # a = OS. path. abspath (_ file _) # obtain the absolute path # print (a) # print (OS. path. dirname (a) # obtain the path of the previous layer # base_dir = OS. path. dirname (OS. path. dirname (a) # obtain the path of the previous layer # print (base_dir) # sys. path. append (base_dir) ''' Infi_chu '''

The above Python3 module, package call, and detailed path are all the content shared by Alibaba Cloud. I hope you can provide a reference and support for the customer's home.

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.