create a subdirectory in our temporary directory : Directory « File « Python Tutorial






import os


os.mkdir('example')
os.chdir('example')
cwd = os.getcwd()
print cwd

print os.listdir(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