Answers for "how to check if python file is empty"

4

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')
Posted by: Guest on August-09-2020

Code answers related to "how to check if python file is empty"

Python Answers by Framework

Browse Popular Code Answers by Language