Skip to content

Instantly share code, notes, and snippets.

@jes
Created November 13, 2020 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jes/1f0c4b9dd07729aad7da6da4f4320360 to your computer and use it in GitHub Desktop.
Save jes/1f0c4b9dd07729aad7da6da4f4320360 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import gzip, os, sys
infile = open("fresh-food-16.json", "r")
b = bytes(infile.read(),"utf8")
n = 0
while True:
n += 1
if n % 1000 == 0:
print(str(n))
with gzip.open("foo.gz", "wb") as f:
f.write(b)
os.unlink("foo")
if os.system("gunzip -k foo.gz") != 0:
sys.exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment