hide code in jupyter notebook

后端 未结 4 1369
时光取名叫无心
时光取名叫无心 2021-01-06 22:23

I have a jupyter notebook that is a mixture of markdown and code. In the end I want to render it out as a pdf report and hide the code. I still want to see the output of t

4条回答
  •  日久生厌
    2021-01-06 22:40

    Please read How to print out from Jupyter Notebook without code blocks.

    Basically you need to add CSS.

    If you want to print out with code use @media print{}. If you want it on the screen, you need to take it out and just run it.

    Paste the following in a cell and run it. Then print it out from a browser File > Print. All codes and output blocks should be gone.

    • You can modify CSS as you like.
    • You can create a template and use it as the base so that you do not need to paste the codes in a cell.
    %%html
     
    

提交回复
热议问题