There are different ways to get file size in Python. We will be using the…
Category: Files and Folders
How to check if a file exists in Python?
When you perform a file operation such as reading from a file or writing content…
How to Create a Directory in Python?
The os module is a built-in utility available in both Python 2 and 3 versions, and…
How to get file extension in Python?
In Python, we can extract the file extension using two approaches. Let’s take a look…
Python – List Files in a Directory
There are several modules available in Python to list files in a directory or folder.…
How to get current directory in Python?
In this article, we will take a look at how to get current directory in…
Python Print to File
We always use print statements in Python to display the output in the console or…
How to Copy a File in Python?
We can copy a file in Python using shutil, os, and subprocess modules. Let’s take…
Python Write Text File
Python provides built-in functions to perform file operations, such as creating, reading, and writing files.…
Python Read Text file
Python provides built-in functions to perform file operations, such as creating, reading, and writing files.…
How to Rename a file in Python?
The os module in Python comes in handy in performing any file operations such as…
Python FileNotFoundError: [Errno 2] No such file or directory Solution
In Python, when you reference a file, it needs to exist. Otherwise, Python will return…