Python-文件路径
获取当前文件的路径import osos.path.abspath(__file__)获取当前目录import osos.getcwd() # 方式1os.path.abspath('.') # 方式2os.path.dirname(__file__) # 方式3路径拼接import os使用join拼接,格式:os.path.join("源目录","待拼接目录")os.path.join(os.path.dirname(__file__), "weight_path")
原创
2020-06-02 07:54:36 ·
164 阅读 ·
0 评论