Last active
April 15, 2019 14:24
-
-
Save syrte/e3b529a031af2998017bcc0249949f32 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import sys | |
import json | |
for file in sys.argv[1:]: | |
print('# file: %s' % file) | |
print('# vi: filetype=python') | |
print('') | |
code = json.load(open(file)) | |
for cell in code['cells']: | |
if cell['cell_type'] == 'code': | |
print('# -------- code --------') | |
for line in cell['source']: | |
print(line, end='') | |
print('\n') | |
elif cell['cell_type'] == 'markdown': | |
print('# -------- markdown --------') | |
for line in cell['source']: | |
print("#", line, end='') | |
print('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment