verify that '/tmp' is a valid directory and change to that temporary directory, call the getcwd() method : Directory « File « Python Tutorial






import os


print os.path.isdir('/tmp')
os.chdir('/tmp')
cwd = os.getcwd()
print cwd








12.4.Directory
12.4.1.verify that '/tmp' is a valid directory and change to that temporary directory, call the getcwd() method
12.4.2.create a subdirectory in our temporary directory
12.4.3.create a test file with two lines and verify that the file has been created by listing the directory again afterward