*2009.07.27 11:23:56 python getcwd current directory working
os.getcwd()ΒΆ
Return a string representing the current working directory. Availability: Unix, Windows.
import os
print os.getcwd()

import sys, os print sys.path[0]

will print the directory where this script resides. additionally you can use

sys.argv[0]

to get the filename of the script. to join the two do

os.path.join(sys.path[0], sys.argv[0])