Created
February 14, 2017 06:19
-
-
Save dwcoates/932ed3cfd514673ff47447c86c1a3537 to your computer and use it in GitHub Desktop.
Second snippet for you
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
| # option 1 | |
| import gzip | |
| fp = gzip.open('foo.gz') | |
| x = json.load(fp.read()) | |
| # option 2 | |
| gzip.open('file.gz', 'rt', encoding='utf-8') | |
| # option 3 | |
| import codecs | |
| zf = gzip.open(fname, 'rb') | |
| reader = codecs.getreader("utf-8") | |
| contents = reader(zf) | |
| for line in contents: | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment