Skip to content

Instantly share code, notes, and snippets.

@keflavich
Created June 24, 2014 17:42
Show Gist options
  • Select an option

  • Save keflavich/467b65b5fae7f20d97eb to your computer and use it in GitHub Desktop.

Select an option

Save keflavich/467b65b5fae7f20d97eb to your computer and use it in GitHub Desktop.
import json
def strip_stream(filename):
jay = json.load(open(filename))
for cell in jay['worksheets'][0]['cells']:
if 'outputs' in cell:
cell['outputs'] = [x for x in cell['outputs']
if not (x['output_type'] == 'stream'
and '\r' in x['text'])]
with open(filename,'w') as outf:
json.dump(jay, outf)
return jay
jay = strip_stream()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment