8 Must-Know File System Operations In Python
The essential for Python in tasks automation apps
In recent years, Python is known by a lot more people who are not programmers. This is not only because of its popularity in the area of Machine Learning but also because it could be used to automate a lot of repetitive works such as bulk editing files with certain patterns.
When the automation tasks are related to files, it is important to master the file system interfaces in Python. In this article, I’ll introduce 8 file system operations in Python that are the most important and essential. Hope it can guide some learners to have an easier start.
All the source code are available in a Google Colab Notebook which has been made public. Please find the link in the last section and try them by yourself!
1. Show Current Directory
The first operation that I want to start with is to show the Current Working Directory (CWD). It is important because we might want to use relative paths in most of the time. Therefore, it is sometimes important to know where we are at the moment.
One of the reasons that the relative path is recommended because it doesn’t create limitations of your application. No matter who copied your application, it should run on their…