python 引用其他的py文件的内容

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/antch620/article/details/88690849
假设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

猜你喜欢

转载自blog.csdn.net/antch620/article/details/88690849