Skip to content

Instantly share code, notes, and snippets.

@bsesic
Last active April 18, 2024 19:37
Show Gist options
  • Save bsesic/507d907d9bfb035754b901b05024b9d9 to your computer and use it in GitHub Desktop.
Save bsesic/507d907d9bfb035754b901b05024b9d9 to your computer and use it in GitHub Desktop.
zip ttl file
def compress_ttl(file_name):
"""
Compress the ttl file.
returns: compressed ttl file.
"""
# compress the ttl file
try:
with open(file_name, 'rb') as f_in:
with gzip.open(file_name + '.gz', 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
except Exception as e:
print("Could not compress file. Error: ", e)
@bsesic
Copy link
Author

bsesic commented Apr 18, 2024

This function zips a turtle file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment