Member-only story
10 Python File System Methods You Should Know
Manipulate Files and Folders With os and shutil
You can write Python programs to interact with the file system to do cool stuff. How to do so isn’t always super clear.
This article is a guide for current and aspiring developers and data scientists. We’ll highlight 10 essential os and shutil commands so you can write scripts to automate interactions with the file system.
The file system is a bit like a house. Say you’re spring cleaning and you need to move boxes of notebooks from one room to another.
The boxes are like directories. They hold things. In this case, notebooks.
The notebooks are like files. You can read and write to them. You can put them in your directory boxes.
Capiche?
In this guide we’ll look at methods from the os and shutil modules. The os module is the primary Python module for interacting with the operating system. The shutil…