Python Learning Notes (ix)

Source: Internet
Author: User

First, the introduction of the Python module

Import SYS #可以通过模块名以及import关键字导入模块


Second, if __name__ = = "__main__"

When Python executes at the command line, the system will set a default value of __name__ to __main__, so that it can be validated when importing modules elsewhere, some methods are not executed


Third, scope

The default scope of variables in Python is public
__NAME__ This variable can be directly referenced but is a special variable, has a special purpose
_name This form of variable defaults to non-public private and should not be directly referenced in other modules


Iv. installation of third-party modules

Pip install third-party module name


Direct import of classes or methods directly using

From module name Import method or class name

Python Learning Notes (ix)

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.