Python 3, read/write compressed json objects from/to gzip file
For Python3, I followed @Martijn Pieters’s code with this: import gzip import json # writing with gzip.GzipFile(jsonfilename, ‘w’) as fout: for i in range(N): uid = “whatever%i” % i dv = [1, 2, 3] data = json.dumps({ ‘what’: uid, ‘where’: dv}) fout.write(data + ‘\n’) but this results in an error: Traceback (most recent call last): … Read more