python check if a file is empty

import os
if os.stat("yourfile.extension").st_size == 0:
#note: file has to be in same directory as python script#

Here is what the above code is Doing:
1. It’s checking if the file is empty.
2. If the file is empty, it prints ’empty’.
3. If the file is not empty, it does nothing.

You can use this code to check if any file is empty or not. Just replace “yourfile.extension” with the name of your file.

I hope this helped you.