A directory or folder is a collection of files and sub-directories. The os module provides various functions that allow us to interact with the operating system. In this section, we will learn about some functions that can be used while working with directories.
Using the os module to work with directories
Get the working directory
To start working with directories, first, we will get the name of our current working directory. The os module has a getcwd() function, using which we can get the current working directory. Start the python3 console and enter the following commands to get the directory name:
$ python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright",...