如何导入驻留在外部目录中的python文件

时间:2014-11-05 12:36:07

标签: python

我有一个常量文件,其中包含代码中常量的一些键和值。

hct/constants.py

我正在我的实用程序中导入它们

hct/data_processors 

在实用程序中进行导入

import constants

执行后我得到一个ImportError。

File "web_page_test_utils.py", line 7, in <module>
import constants
ImportError: No module named constants

如何导入外部目录中的文件。

0 个答案:

没有答案