将该方法放在根目录下面,在其他类中直接import 该方法。
import os def getRootPath(): rootPath = os.path.dirname(os.path.abspath(__file__)) return rootPath