Python 获取文件路径及文件目录

import os

print (os.path.dirname(__file__))
print (os.path.abspath(__file__))
print (os.path.abspath(os.path.dirname(__file__)))
print (os.path.dirname(os.path.abspath(__file__)))

  

posted @ 2017-11-28 09:39  RoyFans  阅读(16411)  评论(0编辑  收藏  举报