Home  >  Article  >  Backend Development  >  What are the keywords for python import modules?

What are the keywords for python import modules?

尚
Original
2020-04-16 13:22:498856browse

What are the keywords for python import modules?

When using Python for programming, some functions do not have to be implemented by yourself. You can use Python's existing standard library or third-party libraries provided by others.

The keyword for importing modules in Python is import.

Python module (Module) is a Python file, ending with .py, containing Python object definitions and Python statements. Modules allow you to organize your Python code snippets logically.

After the module is defined, we can use the import statement to introduce the module. The syntax is as follows:

import module1[, module2[,... moduleN]]

Example:

# 导入sys整个模块
import sys
# 使用sys模块名作为前缀来访问模块中的成员
print(sys.argv[0])

Recommendation: Python graphics and text Tutorial

The above is the detailed content of What are the keywords for python import modules?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn