"Turn" http://blog.csdn.net/windone0109/article/details/8996184
Import the appropriate modules in Python using Import or From...import. module is actually a collection of functions and classes of files , it can achieve some of the corresponding functions, when we need to use these functions, the corresponding modules directly into our program, it can be used. This is similar to the Include header file in the C language.
ImportSYSPrint('======================python Import mode========================')Print('The command line arguments is:') forIinchSYS.ARGV:Print(i)Print('\ nthe python path', Sys.path) fromSysImportArgv,path#import a specific memberPrint('======================python from import=========================')Print('Path:', path)#because the path member has already been imported, it is not required to be written as Sys.path#If you want to use a name that is used by all SYS modules, you can fromSysImport*Print('Path:', path)
From the above we can simply see, import module imports and From...import differences, simply say:
If you want to use ARGV in your program to represent SYS.ARGV, you can use
from Import argv
In general, you should avoid using the import statement with From...import because it makes the program easier to read and avoids conflicting names.
The difference between the import of Python and From...import