在伊普顿运行的类似朱庇特的细胞

ipython-cells的Python项目详细描述


iPython单元格

ipython扩展名,用于在.py文件中执行单元jupyter样式。支持jupyter和spyder单元语法。

将开发期间的线性、选择性执行的优势带到了ipython,而没有jupyter的臃肿。

示例

我们可以像jupyter笔记本一样在.py文件中执行invidual单元。

example.py

# %% cell1a=10print(a)# %% cell2a+=1print(a)

在ipython中:

# load the extension and a .py file%load_extipython_cells%load_fileexample.py# run some cells%cell_runcell110%cell_runcell211# list available cells for running%list_cells['__first','cell1','cell2']

安装
pip install ipython-cells

或者,在ipython启动时自动加载ipython单元格

~/.ipython/profile_default/ipython_config.py

c.InteractiveShellApp.extensions=['ipython_cells']

执行一系列单元格
%load_fileexample.py# run all cells from beginning of file to cell2 (inclusive)%cell_run^cell21011# run all cells from cell1 (inclusive) to end of file%cell_runcell1$1213

自动恢复

# load example.py with autoreloading%load_fileexample.py--autoreload%cell_runcell110# example.py is modified by an external editor (e.g. `a = 10`  ->  `a = 20`)# File change is detected and automatically reloaded%cell_runcell120

单元格分隔符语法

单元格由特殊注释分隔。支持jupyter和spyder样式的单元格。

示例

  • # %% foobar_cell
  • # In[foobar_cell]
  • # %% foobar_cell some extra text
  • # In[foobar_cell] some extra text

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
安卓工作室组织。json。JSONException:类型为java。无法将lang.String转换为JSONObject   java将数据从Jenkins参数化构建传递到testng。运行时的xml   java关注使用所有者框架异步打开JDialog   Android java:broadcastReceiver上的蓝牙连接事件未触发   在java中同时处理写入和读取的文件io   javascript如何替换目标数组字符串并将其更改为用户输入字符串   如何终止或停止java小程序中的其他线程   如何通过SeleniumJava连接到putty以执行一组命令并在putty窗口中验证输出   java为什么空列表上的循环会挂起?   java当我单击run时,什么也没有发生   swing Java多监视器问题   proguard java模块版本不匹配   java在facebook sdk 4.0上获取可标记好友+   java Android Fragmens和滑动示例   java导入。VS代码中的jar库   存储在SQL表中的java下载/显示文件   java项目Euler(第14页):递归问题   java如何在springboot中跳过失败的bean以避免报告失败:771>>应用程序启动失败