python ipython模块_IPython模块

很多人都坚信不应该有IPython语法的脚本,但是如果你有足够的好奇心(就像我一样),并且正在寻找一些有趣的方法来混合python和shell脚本,那么您应该看看我的wrapper program on github

示例用例:$ cat > example.ipy

rehashx

a = !ls -l | tail -n 3

print a.fields(0)

b = 'foo'

echo bar ${b}

^{pr2}$

事实证明,IPython内核还支持上述脚本的一个(几乎不起作用)版本:In [2]: IPython.core.interactiveshell.InteractiveShell.safe_execfile_ipy?

Type: instancemethod

Base Class:

String Form:

Namespace: Interactive

File: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/core/interactiveshell.py

Definition: IPython.core.interactiveshell.InteractiveShell.safe_execfile_ipy(self, fname)

Docstring:

Like safe_execfile, but for .ipy files with IPython syntax.

Parameters

----------

fname : str

The name of the file to execute. The filename must have a

.ipy extension.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值