(1).當"print os.path.dirname(__file__)"所在腳本是以完整路徑被運行的, 那么將輸出該腳本所在的完整路徑,比如:
Pythond:/pythonSrc/test/test.py
那么將輸出 d:/pythonSrc/test
(2).當"print os.path.dirname(__file__)"所在腳本是以相對路徑被運行的, 那么將輸出空目錄,比如:
python test.py
那么將輸出空字符串
(1).當"print os.path.dirname(__file__)"所在腳本是以完整路徑被運行的, 那么將輸出該腳本所在的完整路徑,比如:
Pythond:/pythonSrc/test/test.py
那么將輸出 d:/pythonSrc/test
(2).當"print os.path.dirname(__file__)"所在腳本是以相對路徑被運行的, 那么將輸出空目錄,比如:
python test.py
那么將輸出空字符串