Template request | Bug report | Generate Data Product
Tags: #os #python #snippet #operations #operatingsystem
Author: Florent Ravenel
Description: This notebook demonstrates how to get the current working directory using os
module. The main purpose of the OS module is to interact with your operating system. The primary use I find for it is to create folders, remove folders, move folders, and sometimes change the working directory. You can also access the names of files within a file path by doing listdir(). We do not cover that in this video, but that's an option.
References:
import os
The os.getcwd() function returns the current working directory of the process.
# Get the current working directory
cwd = os.getcwd()
# Print the current working directory
print(cwd)