How to recover deleted Jupyter notebook cell?

前端 未结 6 980
温柔的废话
温柔的废话 2021-01-30 01:05

I use Jupyter notebook. I accidentally deleted a cell, and I can\'t go step back.

How can I recover the notebook cell?

6条回答
  •  梦毁少年i
    2021-01-30 02:04

    if you've already restarted your kernel then %history or _ih[:n] would be empty. You can hope for a recent checkpoint to revert to. You can do this with File > Revert to Checkpoint.

    If you want to be sure what's in the checkpoint before you revert - in your working directory (the one your notebook lives in) you'll have a hidden folder that stores your checkpoints. cd .ipynb_checkpoints will get you there. You can look inside the file and see if your lost code is there.

    This has just saved me. Found this in an answer here

提交回复
热议问题