Python

纪录一些Python常用的函数或者特殊语法

os.path.dirname

# A simple file D:\test.py with code:
print os.getcwd()                                    #D:\
print os.path.basename(__file__)                     #test.py
print os.path.abspath(__file__)                      #D:\test.py
print os.path.dirname(__file__)                      #EMPTY
print os.path.dirname(os.path.abspath(__file__))     #D:\

 

posted @ 2015-12-24 10:44  看起来很好吃  阅读(153)  评论(0编辑  收藏  举报