ignore markdown cells in `jupyter nbconvert` with `--to script`

后端 未结 3 2110
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-22 00:39

Is it possible to have jupyter nbconvert ... --to script ignore markdown cells rather than convert them to comments?

I\'m asking because I want to use

3条回答
  •  情书的邮戳
    2021-01-22 01:19

    There is the command line argument PythonExporter.exclude_markdown that does what you want. To get a list of pep8 errors that just look at the code cells, I run

    jupyter nbconvert my_notebook.ipynb --stdout --to python --PythonExporter.exclude_markdown=True | flake8 - --ignore=W391
    

提交回复
热议问题