The OS moduleinPython provides a way ofusing operating system dependent
functionality.
The functions that the OS module provides allows you to interfacewith the
underlying operating system that Pythonis running on – be that Windows,MacorLinux.
The OS module in python provides functions for interacting with the
operating system. OS, comes under Python’s standard utility modules.
This module provides a portable way of using operating system dependent
functionality.
It is possible to automatically perform many operating system tasks. The
OS module in Python provides functions for creating and removing a
directory (folder), fetching its contents, changing and identifying the
current directory, etc.
Creating Directory
We can create a new directory using the mkdir() function from the OS module.
A new directory corresponding to the path in the string argument of the
function will be created. If we open D drive in Windows Explorer, we
should notice tempdir folder created.