I have a text file. How can I check whether it’s empty or not?
Advertisement
Answer
>>> import os
>>> os.stat("file").st_size == 0
True
I have a text file. How can I check whether it’s empty or not?
>>> import os
>>> os.stat("file").st_size == 0
True