Python 如何将函数从父目录导入测试目录
我正在尝试从同一项目中的目录导入函数。我该怎么做Python 如何将函数从父目录导入测试目录,python,file,testing,path,directory,Python,File,Testing,Path,Directory,我正在尝试从同一项目中的目录导入函数。我该怎么做 .|____project/ | |_____src/ | | |____myproject/ | | | | __init__.py | | | |____funtion.py | |_____test/ | | |___ testmyproject.py | | |____data/ |
.|____project/
| |_____src/
| | |____myproject/
| | | | __init__.py
| | | |____funtion.py
| |_____test/
| | |___ testmyproject.py
| | |____data/
| | |___testdata
如何在test/testmyproject.py中导入function.py文件或function.py文件中的函数来测试功能?我无法从function.py导入模块看一看,我使用的是python 2.7