Interacting with the OS and filesystem
os module in Python provides many functions for interacting with the OS and the filesystem. Let's import it and try out some examples.
We can check the present working directory using the
To get the list of files in a directory, use
os.listdir. You pass an absolute or relative path of a directory as the argument to the function.