OS Module in Python

Sowmiya K
Sep 21, 2021

--

The OS module in Python provides the functions to create, remove, fetching, change and identify the directory (folder), etc. All we need is import os to do these tasks.

To show the Current Working Directory : os.getcwd().

To Make a New Directory : os.mkdir().

To Change a Directory : os.chdir().

To Remove a Directory : os.rmdir().

To List out the Directories: os.listdir().

To Rename a Directory : os.rename().

OUTPUT

--

--

Sowmiya K
Sowmiya K

Written by Sowmiya K

Working for HCL as a Senior Software Engineer | Interested in Networking | cybersecurity | Python

No responses yet