Mega Code Archive

 
Categories / Python Tutorial / File
 

Verify that tmp is a valid directory and change to that temporary directory, call the getcwd() method

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