Recommended 10 Import Module effects

Source: Internet
Author: User
This article focuses on Python's approach to import modules at different levels of the catalog, and it is often useful to use a third-party module package when you need a friend to write a program using Python. This package can be installed via the Python setup install and imported via the import XXX or from xxx import yyy. However, if it is a self-written dependency package, and do not want to install to the corresponding Python directory, you can put in this directory for import to call, in order to clarify the relationship between the program, for example, we will put this package in the Lib directory and then call. This article summarizes the common module invocation methods. One, the same level directory of the program structure is as follows:--src |--mod1.py |--test1.py If import module test1.py in the program MOD1, then directly use import MOD1 or from mod1 import *;

1. Analyzing Python's approach to import modules at different levels of the catalog

Introduction: This article mainly introduces python in different levels of directory Import module method, the need for friends can refer to the following

2. Python uses tips

Introduction: 1. Import module often uses import declarations in Python to use objects defined in other modules (that is, other. py files). (1), using __name__ write test statement below is a simple library program testlib.py. When running testlib.py directly, __name__ is "__main__". If it is import, ...

3. Python Module Search concept Introduction and Module installation Method introduction

Introduction: This article mainly introduces the Python module search concept Introduction and the module installation method Introduction, this article explained in detail the Import module operation principle, the search path process as well as the module installs the many methods, needs the friend can refer to the next

4. Import module with old Ziko python

Introduction: This article mainly explains the basic import module method, first from the definition of the module, and then tell how to write their own module, very simple and practical, the need for friends can refer to the next

"Related question and answer recommendation":

Python-what is the meaning of parentheses () when importing modules using from XXX import (xxx, xxx, xxx)?

How do I import a dependent module that I wrote when Python-spark submit?

python-pycharm2.7.3 cannot import module

pycharm2.7.3 cannot import module

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.