Python Day05 python environment variables and import module imports

Source: Internet
Author: User
1. Define the module: The essence is. py file (logically organized Python code) The essence of the module is to implement a function filename is the module name package: a folder with __init__.py; to store module files 2. Importing module import module Name form module name Import * from module name import module name as new name 3. Import module Essential Import Module NAME = = = The module name is assigned to all data in the module, and the module name is required when calling. Method Name () from Module name Import method name = = "Put this method in the current file to run once, call only the method name () to run the import of a package is to execute the package The __init__.py file path under the search for import Sys,osos.path.abspath (__file__) #获取当前文件的全名os. Path.dirname () #获取当前对象的父级目录sys. Path.insert () #将当前对象的路径添加到首位sys. Path.append () # Add the current environment variable to the end of the environment variable

Python Day05 python environment variables and import module imports

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.