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')
4.29
7
>>> import os
>>> os.stat("file").st_size == 0
True
Thank you!
7
0
Are there any code examples left?
New code examples in category Python