8 .Python獲取項目路徑

import os print(__file__) # 當前文件路徑 print(os.path.dirname(__file__)) # 上一層目錄 # 1 工程路徑 project_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 2 配置路徑 config_path = os.path.jion(project_path,'configs') #3 數據路徑 data_path = os.path.jion(project_path,'configs') # report_path = os.path.join(project_path,r'outFies\report\tmp')
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章