转载 https://www.cnblogs.com/angdh/p/10632651.html



root_path = os.path.abspath(os.path.dirname(__file__)).split('shippingSchedule')[0]
(相对的路径(获取文件当前路径)).剪切("匹配字符")[0]

base_dir = os.path.join(sys.path[1], '')
yaml_name = os.path.join(base_dir, 'config','gczx_caps.yaml')

 

当前路径的相对路径

base_dir = os.path.dirname(os.path.dirname(__file__))

 

相关文章:

  • 2021-09-11
猜你喜欢
  • 2021-08-12
  • 2022-12-23
  • 2021-11-27
  • 2021-11-27
  • 2021-09-04
相关资源
相似解决方案