84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
有一个包 pack,里面有__init__.py ,test.py若我在__init__.py中导入 test.py 采用
import test
运行__init__.py 没问题,但在包外 导入pack 出现问题,找不到test若采用
from . import test or from pack import test
__init__.py就找不到test,包外导入pack,就没问题,这是为什么?
认证高级PHP讲师
Pay attention to python’s module search process: https://docs.python.org/2/tut...
Run __init__.py to import test because the program runs in the current directory, that is, the pack directory is automatically added to the module search path.
Pay attention to python’s module search process: https://docs.python.org/2/tut...
Run __init__.py to import test because the program runs in the current directory, that is, the pack directory is automatically added to the module search path.