Python pour module method

Source: Internet
Author: User

There are three ways to import a Python module: (only the three types are known in small series)

Next, we'll show you how to use the three different ways.

Method one, direct reference

#引用, such a reference would introduce all the methods in the Sys module, in a sense it would have a little effect on the program. Import os# using Os.system (' pwd ')

Method two, referring to a single or multiple methods in a module

#引用, this will only refer to the required method if the introduced method is particularly long can be renamed from OS Import system as sys# using SYS (' pwd ')

Method Three, apply all the variables of a module

#引用, this introduces all the commands in the OS module, and the use method does not need to enter "OS." earlier. So the problem is, if the code has a path variable, the introduction of the module happens to have the path method, then the path method will be your local path variable to overwrite, so this method is not recommended to use the From OS Import * #使用os. System (' pwd ' )



This article is from the "Loyalty" blog, make sure to keep this source http://xinsir.blog.51cto.com/5038915/1749987

Python pour module method

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.