Python中import和from import

Python里面的import和from import都是用于导入一个模块,两者的区别是

如果你在使用某模块内函数时不想写模块名,那么就用from import方式导入,如果是用import方式就要写模块名 比如

sys.argv 如果你不想写sys 那么在代码开头就应该这样写

from sys import argv

原文地址:https://www.cnblogs.com/hdflzh/p/4052729.html