假设Python的脚本文件需要引用常量文件的常量,需要添加一下代码,找到多引用的文件。 import sys
curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath)
from common.const import const
假设Python的脚本文件需要引用常量文件的常量,需要添加一下代码,找到多引用的文件。 import sys
curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath)
from common.const import const