Advertisement
Felanpro

Directories with the os module.

Jul 31st, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. import os #Import the os module from python standard library.
  2.  
  3. current_directory = os.getcwd() #Get current directory.
  4. print(current_directory) #Print it.
  5.  
  6. os.mkdir("NewDir") #Create a new directory.
  7.  
  8. os.rename("NewDir", "AwesomeDir") #Rename directory.
  9.  
  10. os.rmdir("NewDir") #Delete directory.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement