Python-import xx 和 from xx import xx 的区别
1.import xx :导入模块,在使用的时候需要 “ 模块.函数 ”来使用
例如:
1 import math 2 math.sqr(5)
2.from xx import xx 和 from xx import *
这两个本质没有区别,都是从其它模块里面导入函数。但是唯一的区别就是* 能够导入某个模块的所有东西。
而from xx import xx 在使用的时候可以直接使用xx 函数。
例如
from test import test_ from test import * test_() test_()
本文来自博客园,作者:许个未来—,转载请注明原文链接:https://www.cnblogs.com/future-panda/p/16918557.html

浙公网安备 33010602011771号