Bir .py dosyasının yürütüldüğü geçerli dizinin yolunu almak istiyorum.
Örneğin D:\test.py, kod içeren basit bir dosya :
import os
print os.getcwd()
print os.path.basename(__file__)
print os.path.abspath(__file__)
print os.path.dirname(__file__)
Çıktının garip olması:
D:\
test.py
D:\test.py
EMPTY
Ben aynı sonuçları bekliyorum getcwd()ve path.dirname().
Verilen os.path.abspath = os.path.dirname + os.path.basename, neden
os.path.dirname(__file__)
boş döner?