Friday, May 29, 2009

How to get the current working directory in Python

In Python you can get the current directory using the function getcwd from the os module. The output is displayed as a string. Basically corresponds to the pwd command that you can use in a Unix terminal.

PS
As you can guess, getcwd stands for get current working directory


>>>>import os
>>>>os.getcwd()

No comments:

Post a Comment

Your comment will be visible after approval.