Created
December 8, 2016 20:14
-
-
Save miodeqqq/3de707c33306ae3d6e0cf9a3c13f92b1 to your computer and use it in GitHub Desktop.
Python function to check if *.tar.gz file is empty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_nonempty_gz_file(self, tarfile): | |
with open(tarfile, 'rb') as f: | |
try: | |
file_content = f.read(1) | |
return len(file_content) > 0 | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment