ipython如何执行多条历史记录行 [英] ipython how to execute several history lines

查看:603
本文介绍了ipython如何执行多条历史记录行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ipython中,我们可以使用

In ipython, we can use

_ih[32:39] 

显示32到39之间的历史记录行。如何直接执行这些历史记录行?

To show history lines between 32 and 39. How can I directly execute these history lines?

推荐答案

我使用列表表示法:

exec In[34:36]

如果你使用编辑功能来编辑一个块,那么Out列表中会包含你的代码,所以:

also, if you use the edit function to edit a chunk, the Out list will have your code in it, so:

exec Out[35]

我的最爱:

edit In[34:38]

因为我是一个胖胖的傻瓜,在第一次尝试时很难做到。

because I am a fat-fingered slob who can rarely get it right on the first try.

这篇关于ipython如何执行多条历史记录行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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