A preliminary knowledge of Python common modules

Source: Internet
Author: User

Module is the code that encapsulates a particular function.

The modules are divided into three types:

1. Custom Modules

2; third-party modules

3. Built-in Modules

One, custom module

test.py

#!/usr/bin/env python

#-*-Coding:utf-8-*-

Print ("I am Test")

Print ("I am Test1")

Print ("Hello World")

sys.py (the file calls the test module)

#!/usr/bin/env python

#-*-Coding:utf-8-*-

Import Test

Second, third-party modules

The third module is unclear

Three, built-in modules

Anyway a lot, here only three records are getpass, OS, sys

1. load a simple module getpass (Note: This notation is not available in Pycharm )

#!/usr/bin/env python

#-*-Coding:utf-8-*-

#写一个简单模块, this module is not available in Pycharm

Import Getpass

Username = input ("Username:")

Password = getpass.getpass (' Password: ')

Print (Username,password)

2. Loading an OS module

#!/usr/bin/env python

#-*-Coding:utf-8-*-

Import OS

Os.system ("Df-h")

3. Load SYS module

#!/usr/bin/env python

#-*-Coding:utf-8-*-

Import Sys

Print (Sys.path)


This article is from "think one or two" blog, please be sure to keep this source http://250919938.blog.51cto.com/962010/1907473

A preliminary knowledge of Python common modules

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.