Lesson - 41 : Python3 - Python File Handling : Directories in python

Veröffentlicht am: 03 Januar 2018
auf dem Kanal: Sada Learning Hub
113
1

**************************************************
Python Core PlayList :    • Lesson - 01 : Python3 - What is python  
Python Advanced PlayList :    • Lesson - 46 : Python Advanced - Pytho...  
**************************************************
Python File Handling : Directories in python:
All files are contained within various directories, and Python has no problem handling these too. The os module has several methods that help you create, remove, and change directories.
The mkdir() Method
You can use the mkdir() method of the os module to create directories in the current directory. You need to supply an argument to this method which contains the name of the directory to be created.
os.mkdir("newdir")

The chdir() Method
You can use the chdir() method to change the current directory. The chdir() method takes an argument, which is the name of the directory that you want to make the current directory.
os.chdir("newdir")

The getcwd() Method
The getcwd() method displays the current working directory.
os.getcwd()

The rmdir() Method
The rmdir() method deletes the directory, which is passed as an argument in the method.
os.rmdir('dirname')

Sample Projects : https://github.com/SadaLearningHub1/P...


Auf dieser Seite können Sie das Online-Video Lesson - 41 : Python3 - Python File Handling : Directories in python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Sada Learning Hub 03 Januar 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 113 Mal angesehen und es wurde von 1 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!