Advertisement
rfmonk

os.chdir.example1.py

Dec 23rd, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. #! /usr/bin/env python
  2.  
  3. """ The method chdir() changes the current working directory
  4. to the given path. It returns NONE in all the cases.
  5.  
  6. Syntax is os.chdir(path)
  7. Parameters: path is the complete path of the directory to be
  8. changed to a new location.
  9.  
  10. This method does not return any value. """
  11.  
  12. import os
  13.  
  14. path = "/usr/tmp"
  15.  
  16. # Check the current working directory.
  17. retval = os.getcwd()
  18. print "Current working directory %s" % retval
  19.  
  20. # Now change the directory
  21. os.chdir(path)
  22.  
  23. # Check the current working directory.
  24. retval = os.getcwd()
  25.  
  26. print "Directory changed successfully %s" % retval
  27.  
  28. """ from www.tutorialspoint.com/python/os_chdir.htm """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement