In this article we will discuss how to get the current working directory in Python.

Python’s os module provides a function to get the current working directory i.e.

It returns a string containing the current working directory.

For calling this function we need to import os module i.e.

Let’s understand by an example,

Get the Current Working Directory in Python

It will return the current working directory. In our system output was,

Let’s change the current working directory to ” .

Now let’s get the current working directory,

Now output in our system was,

because we changed the current working directory.

Complete example is as follows,



Join LinkedIn Group of Python Professional Developers who wish to expand their network and share ideas.

You can also follow us On Twitter :

Click Here to Subscribe for more Articles / Tutorials like this.