python检查文件是否为空

 

 

import os    
os.path.getsize(fullpathhere) > 0

 

>>> import os
>>> os.stat("file").st_size == 0
True

 

posted on 2021-07-16 09:56  一杯明月  阅读(408)  评论(0)    收藏  举报