美文网首页
os.path.dirname

os.path.dirname

作者: lucasdada | 来源:发表于2016-11-29 15:00 被阅读0次

(1).当"print os.path.dirname(__file__)"所在脚本是以完整路径被运行的, 那么将输出该脚本所在的完整路径,比如:

Pythond:/pythonSrc/test/test.py

那么将输出 d:/pythonSrc/test

(2).当"print os.path.dirname(__file__)"所在脚本是以相对路径被运行的, 那么将输出空目录,比如:

python test.py

那么将输出空字符串

相关文章

网友评论

      本文标题:os.path.dirname

      本文链接:https://www.haomeiwen.com/subject/ymnapttx.html