Created
February 14, 2022 20:36
-
-
Save syrte/97efeef9416d28ba52d6163150b19be9 to your computer and use it in GitHub Desktop.
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
#!/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
The code displays jupyter notebook input cells in terminal.
Usage:
One can view it in vim