>>> import os >>> print(os.path.dirname(os.path.realpath(__file__))) C:FileLocation # Does not contain filename
import os print(os.path.abspath(''))