file-length

How to check whether a file is empty or not

How to check whether a file is empty or not Question: I have a text file. How can I check whether it’s empty or not? Asked By: webminal.org || Source Answers: import os os.path.getsize(fullpathhere) > 0 Answered By: Jon >>> import os >>> os.stat(“file”).st_size == 0 True Answered By: ghostdog74 If for some reason you …

Total answers: 11