Jupyter笔记本:如何在“全部运行"时留出一个单元 [英] Jupyter notebook: how to leave one cell out while 'run all'

查看:394
本文介绍了Jupyter笔记本:如何在“全部运行"时留出一个单元的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jupyter笔记本编写python,我有两个相互影响的单元.

I'm writing python using jupyter notebook and I have two cells that can influence each other.

我想知道单击Restart & Run All后是否可以保留某些单元格,以便我可以独立测试两个单元格?

I'm wondering is it possible to leave some certain cells out after I click Restart & Run All so that I can test the two cells independently?

推荐答案

基于Davide Fiocco对

One option based on Davide Fiocco's answer of this post and that I just tested is to include %%script magic command on each cell you don't want to execute. For example

%%script false --no-raise-error
for i in range(100000000000000):
    print(i)

这篇关于Jupyter笔记本:如何在“全部运行"时留出一个单元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆