所以我正在尝试将我在单个文件中所做的一些代码重构为一些更易于管理的部分。但是,我无法弄清楚如何在我自己的文件中进行导入以挽救我的生命。
我想在 sandbox.py 中使用 mytest。这样做的正确语法是什么?我附上了目录结构的照片。我正在使用 Python 3.8.2
testdir通过在其中创建__init__.py文件来创建为包testdir
testdir
__init__.py
sandbox.py
from testdir import testfile a = testfile.mytest(something)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
点击生成二维码
我来说两句