Explain how python references package package

The method of referencing packages in python:

In python, you can use the "import package name" statement to reference the package

Example: introducing time

import time

The package can also be referenced by "from package name import class name"

Example: Introducing the time.time class

from time import time

Content expansion:

What is Python Package

How to distinguish that the directory you see is a Python Package package? It's actually very simple. You just need to see if there is a "init.py" file under this directory. If there is, then it is a Python Package package. If not, just say what you see is an ordinary directory, as shown in the figure below. You can see that "calcuate" and "Log" are a Python Package, and "yinzhengjie" is a directory, and the judgment is based on whether it contains the_init__.py file

Python is a flexible language. It can also be said that python is a glue language. As the name suggests, it can import all kinds of packages. Python packages can be said to be the most of all languages. Of course, most of the import packages are for faster, more convenient and more efficient. For Python lovers who are just getting started, the first contact should be the way that import directly imports the package. For example, import time is to import the time package of python. The methods in this package can handle most of the time encountered in our projects The problem.

So far, this article on how to cite a package in python is introduced. For more related python citation methods, please search for ZaLou.Cn's previous articles or continue to browse the related articles below. Hope you will support ZaLou more in the future. Cn!

Recommended Posts

Explain how python references package package
How Python parses XML
How Python converts string case
How does Python output integers
How does python output backslashes
How to learn python quickly
How to uninstall python plugin
Python3 logging log package example
How Python implements FTP function
How to understand python objects
How does python update packages
Python installation impala package steps
How does python perform matrix operations
How to use python thread pool
How Python implements the mail function
How does python change the environment
How to write python configuration file
How to wrap in python code
How to save the python program
How to omit parentheses in Python
How to install Python 3.8 on CentOS 8
How to install Python 3.8 on Ubuntu 18.04
How to filter numbers in python
How does python call java classes
How to read Excel in Python
Install python package using Douban source
How to install Python on CentOS 8
How does python import dependency packages
How to solve python dict garbled
How to view errors in python
How does python enter interactive mode
How Python operates on file directories
How Python implements the timer function
How to view the python module
How to understand variables in Python
How to clear variables in python
How to understand python object-oriented programming
How does python determine prime numbers
How to use SQLite in Python