<s>[INST] How to get full path of current file's directory in Python? I want to get the current file's directory path.
I tried: 
>>> os.path.abspath(__file__)
'C:\\python27\\test.py'

But how can I retrieve the directory's path?
For example:
'C:\\python27\\'

 [/INST] If you mean the directory of the script being run:
import os
os.path.dirname(os.path.abspath(__file__))

If you mean the current working directory:
import os
os.getcwd()

Note that before and after file is two underscores, not just one. 
 </s>