code_junkie

How do I “cd” in python

Nov 13th, 2011
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. os.chdir
  2.  
  3. os.chdir("/path/to/change/to")
  4.  
  5. from __future__ import with_statement
  6. from grizzled.os import working_directory
  7.  
  8. with working_directory(path_to_directory):
  9. # code in here occurs within the directory
  10.  
  11. # code here is in the original directory
Add Comment
Please, Sign In to add comment