将该方法放在根目录下面,在其他类中直接import 该方法。

import os


def getRootPath():
    rootPath = os.path.dirname(os.path.abspath(__file__))
    return rootPath

 

相关文章:

  • 2021-09-18
  • 2021-05-26
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-06
  • 2021-06-12
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
相关资源
相似解决方案