Introduction
In this lab, you will learn how to check if a file is empty in Python. First, you'll create an empty file named my_empty_file.txt
using the touch
command in the terminal. You'll then verify its creation and size using ls -l
and stat
commands.
Next, you'll use the os.path.getsize()
function in Python to programmatically determine the file's size. You'll create a Python script named check_size.py
and implement the logic to check if my_empty_file.txt
is empty based on its size.