Python @ DjangoSpin

Python: Changing Current Directory

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon
Reading Time: 1 minutes

Current Directory in Python

Current Directory in Python

In order to check the current directory in Python, you can use the getcwd() function of the standard library os.

current directory

import os
print( os.getcwd() )

To change the current directory, use the chdir() function.

import os
os.chdir(path)					# e.g. os.chdir(r'C:\Users\')

See also:

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon

Leave a Reply