如何在同一个目录或子目录中导入类?我有一个目录,存储所有的.py档案。bin/
main.py
user.py # where class User resides
dir.py # where class Dir resides我想使用user.py和脏皮在……里面Main.py.如何将这些Python类导入Main.py?此外,如何导入类?User如果user.py在子目录里吗?bin/
dir.py
main.py
usr/
user.py
3 回答

呼如林
TA贡献1798条经验 获得超3个赞
from .user import Userfrom .dir import Dir
添加回答
举报
0/150
提交
取消