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:\

 

你可能感兴趣的:(Python)