get working directory in python

2 June, 2006 - 16:14

This is mainly a reminder to myself, because I always forget it and spend to much time to find it again. It's so simple/basic that it is almost embarrassing.
To get the current working directory of in a python script, like you have pwd (print working directory) on a Linux/Unix command line:

import os
print os.getcwd()