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