所以我开始在我的Mac上使用IPython。 !!!运算符(应该执行shell命令并将输出作为有用数据)正在生成语法错误。它似乎只是将它解释为(!(!ls)),并吐出!ls:命令未找到。我不能谷歌感叹号,我不知道还有什么地方可以打IPython!不工作
2
A
回答
5
我想你可能只想要一个感叹号[docs],至少如果你想对输出做任何事情。例如:
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']
,但(这是我假设你看到)
In [10]: z = !!ls
In [11]: z
Out[11]: ['/bin/sh: !ls: command not found']
您可以什么!!ls
实际上没有更多的信息输入%sx?
。
2
相关问题
- 1. IPython的不工作
- 2. %load_ext rpy2.ipython在iPython中工作,但不在iPython Notebook中
- 3. Django manage.py不能与IPython一起工作
- 4. matplotlib.widget不工作在ipython笔记本
- 5. search_results不是在工作IPython中
- 6. 调试器IPython中不工作
- 7. Tkinter GUI不能在iPython之外工作
- 8. IPython如何?操作员实际工作?
- 9. 导入图形工具不能在iPython上工作
- 10. ipython笔记本无法在ipython 2.2.0上工作
- 11. 访问从IPython工作的文件directroy
- 12. IPython的魔术%paste如何工作?
- 13. IPython笔记本无法正常工作
- 14. 让PyScripter Portable与IPython一起工作
- 15. 无法使cProfile在IPython中工作
- 16. 如何IPython的魔法工作
- 17. Ipython matplotlib交互模式如何工作?
- 18. ipython变量扩展如何工作?
- 19. 如何让matplotlib在IPython下工作?
- 20. 用工作服测试Jupyter/iPython?
- 21. ipython历史完成部分工作
- 22. 字符串替换不工作for循环,但在IPython控制台工作
- 23. 日期不工作在ipython笔记本电脑,但在朱莉亚工作REPL
- 24. 脚本工作在ipython中,但不是从命令行
- 25. 在IPython的命令行tensorflow工作,但不是在笔记本
- 26. IPython的历史记录搜索后退不能正常工作
- 27. 模块在python解释器中工作,但不在iPython中
- 28. 在Python-3.x和IPython中quit()的工作方式不同
- 29. make_table()不工作if if语句中的iPython(Jupyter)
- 30. awk中与管道不Jupyter笔记本工作IPython的打印
你正在将执行shell('sh','bash'等)的特性与python的REPL混合起来。你能否用更具体的细节来解决问题?这与python有什么关系? –
@BrianCain这是IPython的一个特性(注意领先的'I')。一个增强的REPL,允许使用shell命令。 – Keith
@凯斯,好吧,我现在在船上。但我仍然认为'!!'不是OP想要的。这可能只是“!”,对吧? –