There are three ways to import a Python module: (only the three types are known in small series)
Next, we'll show you how to use the three different ways.
Method one, direct reference
#引用, such a reference would introduce all the methods in the Sys module, in a sense it would have a little effect on the program. Import os# using Os.system (' pwd ')
Method two, referring to a single or multiple methods in a module
#引用, this will only refer to the required method if the introduced method is particularly long can be renamed from OS Import system as sys# using SYS (' pwd ')
Method Three, apply all the variables of a module
#引用, this introduces all the commands in the OS module, and the use method does not need to enter "OS." earlier. So the problem is, if the code has a path variable, the introduction of the module happens to have the path method, then the path method will be your local path variable to overwrite, so this method is not recommended to use the From OS Import * #使用os. System (' pwd ' )
This article is from the "Loyalty" blog, make sure to keep this source http://xinsir.blog.51cto.com/5038915/1749987
Python pour module method