is file empty python code example
Example 1: 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#
print('empty')
Example 2: python check if file has content
>>> import os
>>> os.stat("file").st_size == 0
True