IPython历史中的错误?

时间:2013-04-11 08:22:53

标签: ipython

这是一个错误,还是我对IPython中的%hist没有理解?

In [79]: hist -g shapely
102/16: from shapely import Point, mapping
102/17: from shapely import Point, mapping
102/18: from shapely import mapping
102/19: import shapely
102/20: shapely?
140/53: import shapely
54: import shapely

In [80]: hist -n ~102/14-20
122/14: l
122/15: ls
122/16: nco.variables.keys()
122/17: ls
122/20: nco.sync()

好?似乎有20的偏差...为什么?

In [81]: hist -n ~122/14-20
102/14: utm33N = pyproj.Proj(proj='utm', zone=33, south=False, ellipse='ED50')
102/15: import ogr
102/16: from shapely import Point, mapping
102/17: from shapely import Point, mapping
102/18: from shapely import mapping
102/19: import shapely
102/20: shapely?

1 个答案:

答案 0 :(得分:1)

您已将其翻转,请参阅%history?的输出以获取有关如何调用它的信息

相关位:

``243/1-5``
    Lines 1-5, session 243
``~2/7``
    Line 7, session 2 before current

所以%history -n ~102/14-20实际上是102次之前的第14-20行。对于会话102,删除代字号:

%history -n 102/14-20