xxxxxxxxxx
>>> os.chdir('C:\\Python33')
>>> print(os.getcwd())
C:\Python33
xxxxxxxxxx
pip install path
from path import Path
# set working directory
Path("/toWhereYouWantItToBe").cd()
xxxxxxxxxx
# Import the os module
import os
# Print the current working directory
print("Current working directory: {0}".format(os.getcwd()))
# Change the current working directory
os.chdir('/tmp')
# Print the current working directory
print("Current working directory: {0}".format(os.getcwd()))
xxxxxxxxxx
# Import the os module
import os
# Get the current working directory
cwd = os.getcwd()
# Print the current working directory
print("Current working directory: {0}".format(cwd))
# Print the type of the returned object
print("os.getcwd() returns an object of type: {0}".format(type(cwd)))