What did the import of Python do?

Source: Internet
Author: User

or copy it, https://www.cnblogs.com/yan-lei/p/7828871.html from here.

Python code in one module gains access to the code in another module by the process of importing it.

Two concepts:

module: Used to organize Python code (variables, functions, classes) from logic (to implement a function), essentially *.py files. The file is physically organized "module_name.py", and the module is logically organized "module_name".

Package: Defines a python application execution environment consisting of modules and sub-packages, essentially a hierarchical file directory structure (must have a __init__.py file).

1 # Import a module 2 Import Model_name 3 # Importing multiple modules 4 Import module_name1,module_name2 5 # imports the specified properties, methods (without parentheses), classes in the module 6  from import moudule_element [as New_name]

What did the import of Python do?

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.