如何:从Jupyter / IPython笔记本中挽救丢失的代码

本文介绍了当您不小心删除了Jupyter Notebook中包含重要功能的单元格时,如何恢复代码的方法。通过调用特定函数,可以从Python解释器内部获取代码并创建新的单元格来解决问题。
摘要由CSDN通过智能技术生成

Jupyter (formerly known as IPython) notebooks are great – but have you ever accidentally deleted a cell that contained a really important function that you want to keep? Well, this post might help you get it back.

Jupyter(以前称为IPython)笔记本非常棒-但是您是否偶然删除了包含要保留的非常重要功能的单元格? 好吧,这篇文章可能会帮助您找回。

So, imagine you have a notebook with the following code:

因此,假设您有一个带有以下代码的笔记本:

Screen Shot 2016-04-15 at 12.52.40 and then you accidentally delete the top cell, with the definition of your function…oops! Furthermore, you can’t find it in any of your ‘Checkpoints’ (look under the File menu). Luckily, your function is still defined…so you can still run it:

然后您不小心删除了具有功能定义的顶部单元格……糟糕! 此外,您无法在任何“检查点”中找到它&#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值