Skip to content

Instantly share code, notes, and snippets.

@Sejmou
Last active January 6, 2023 14:19
Show Gist options
  • Save Sejmou/15df6a88e8e1232f9b77a9be6918b029 to your computer and use it in GitHub Desktop.
Save Sejmou/15df6a88e8e1232f9b77a9be6918b029 to your computer and use it in GitHub Desktop.
Simple one-liner for printing notebook code without any lines containing only single variable or accessed prop on its own (caution: only works in Unix systems, doesn't detect expressions like 3+4 or tuples containing variables/expressions at end of cell)
jupyter nbconvert --stdout --no-prompt --to script notebook.ipynb | grep -Ev '^\s*\(*[a-zA-Z0-9_\.,\s]+\)*\s*$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment