多文件的组织
跨目录级导入模块
from ..xxfile import xxmodule #从上级目录中的xxfile中导入xxmodule
import xxsub_dir.xxfile #从xxsub_dir文件夹中导入所有模块
执行时的命令
python -m pkg.tests.core_test #去最顶级执行
跨目录级导入模块
from ..xxfile import xxmodule #从上级目录中的xxfile中导入xxmodule
import xxsub_dir.xxfile #从xxsub_dir文件夹中导入所有模块
执行时的命令
python -m pkg.tests.core_test #去最顶级执行
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。