Skip to content

Instantly share code, notes, and snippets.

@mirekfranc
Created August 24, 2016 13: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 mirekfranc/d700987c5e6b5e733fe224c5299e1134 to your computer and use it in GitHub Desktop.
Save mirekfranc/d700987c5e6b5e733fe224c5299e1134 to your computer and use it in GitHub Desktop.
Read JSON from zip archive
from __future__ import print_function
import zipfile
archive = 'something.zip'
with zipfile.ZipFile(archive, 'r') as myzip:
for zi in myzip.infolist():
if zi.filename.endswith('.json'):
with myzip.open(zi, 'rU') as f:
for line in f:
print(line, end='')
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment