如何在ipython中解压shell escape的输出?在
实例(作品):
In [1]: !locate .hgrc
/home/wim/.hgrc
/usr/share/doc/mercurial-common/examples/sample.hgrc
In [2]: hgrcs = !locate .hgrc
In [3]: hgrcs[0]
Out[3]: '/home/wim/.hgrc'
但这行不通:
^{pr2}$同样不起作用:
In [13]: x = !locate .hgrc | head -1
In [14]: x
Out[14]: ['/home/wim/.hgrc']
In [15]: x, = !locate .hgrc | head -1
File "<ipython-input-15-524d2c9ab16f>", line 1
x, = !locate .hgrc | head -1
^
SyntaxError: invalid syntax
python3.3.2+上的IPython 0.13.2。在
这个问题在我提交了一个issue后不久就解决了。在
https://github.com/ipython/ipython/pull/5321
恶心,但对于这个特殊的案例:
相关问题 更多 >
编程相关推荐