python如何判断文件为空?获取文件大小,如果文件大小等于0则为空,如下:importossize=os.path.getsize('d:/abc.txt')ifsize==0:print('Thefileisempty')else:print('Thefileisnotempty')如何使用Python函数os.path.getsize()获取文件大小:os.path.getsize(filename)以上是详细内容python如何判断一个文件为空,希望对大家有所帮助。阅读原文:点击查看原文
