[英]IPython !! not working
So I've starting using IPython on my Mac. 因此,我开始在Mac上使用IPython。 The !! !! operator, which is supposed to execute a shell command and get the output as useful data, is generating syntax errors. 应该执行shell命令并将输出作为有用数据的运算符正在生成语法错误。 It appears to be just interpreting it as (! (!ls)), and spitting out !ls: command not found. 它似乎只是将其解释为(!(!ls)),然后吐出!ls:命令未找到。 I can't google exclamation marks and I didn't know where else to turn 我无法使用谷歌感叹号,也不知道该去哪里
I think you probably only want a single exclamation mark [docs] , at least if you want to do anything with the output. 我认为您可能只需要一个感叹号[docs] ,至少在您要对输出执行任何操作时。 For example: 例如:
localhost-2:tmp $ ipython
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
Type "copyright", "credits" or "license" for more information.
IPython 0.12 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: !ls
a.txt
In [2]: z = !ls
In [3]: z
Out[3]: ['a.txt']
In [4]: !!ls
Out[4]: ['a.txt']
but (which is what I'm assuming you're seeing) 但是(这就是我所假设的)
In [10]: z = !!ls
In [11]: z
Out[11]: ['/bin/sh: !ls: command not found']
You can type %sx?
您可以输入%sx?
for more information about what !!ls
actually does. 有关!!ls
实际功能的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.