我的文件结构是这样的:
app/
__init__.py
a.py
在__init__.py中定义函数
def fun1():
print('hehe')
在a.py中import,下边的都失败了
from . import fun1
from ..app import fun1
成功的方式有一点粗暴
from .__init__ import fun1
不过没见过这样import的,在网上搜的都不管用,不知道怎么回事。。。。谢谢啦
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
a.py