python3中的os.path.dirname(__file__)的使用

os.path.dirname(__file__)的做用是 返回脚本的路径,即文件路径中所在的目录(不包含文件名),以下:spa import os path = os.path.dirname('D:\test\t.py') print(path) 结果: code D:\test Process finished with exit code 0 注意事项:it 在运行的时候若是输入完整的执
相关文章
相关标签/搜索