Day2 [4]. The installation and use of third-party modules

Course targets

1. Module
2. Install third-party modules

Using the Module

• .Py a file called a module (Module)
• Benefits:
1. facilitate code maintenance, the number of functions into different files, a file .py
A small amount of code
2. A module can be referenced elsewhere in the code without having to write from zero onwards
3. Use the module also avoid function names and variable name conflicts. Letter of the same name
And variables can exist in different modules, respectively,
 
 

Using the Module

• sub-module built-in modules and third-party modules
• Benefits Python interpreter to set a special variable __name__ __main__,
If the module is introduced into the hello elsewhere, if the determination fails
• Use the import hello

Install third-party module

• pip install Pillow
• Use another release of Python, Anaconda
• Pycharm installed inside

summary

• Custom Modules
• refer to other people's modules
• referenced third-party modules

Guess you like

Origin www.cnblogs.com/zsczsc/p/11886587.html