Skip to content

Instantly share code, notes, and snippets.

@basnijholt
Last active September 17, 2015 18:41
Show Gist options
  • Save basnijholt/2ed10ccc90523d10ac1d to your computer and use it in GitHub Desktop.
Save basnijholt/2ed10ccc90523d10ac1d to your computer and use it in GitHub Desktop.
Take only notes from ipynb
def isnote(cell):
try:
return cell['metadata']['slideshow'][u'slide_type'] == 'notes'
except KeyError:
return False
with open('Presentation.ipynb') as json_data:
data = json.load(json_data)
data['cells'] = [cell for cell in data['cells'] if isnote(cell)]
json.dump(data2, open('Presentation-notes.ipynb', 'w'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment