在 IPython 中运行外部命令
我想从 IPython 配置运行一个新命令并捕获其输出。基本上,我想通过普通函数访问 !command
的等效项。我知道我可以只使用 subprocess
,但由于 IPython 已经提供了此功能,我想 API 中的某个位置必须包含一个正确制作的包装器。
I'd like to run a new command from IPython configuration and capture its output. Basically, I'd like to access the equivalent of !command
via normal functions. I know I can just use subprocess
, but since IPython already provides this functionality, I guess there must be a properly made wrapper included somewhere in the API.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,这样的包装器可以通过 ip.IP.getoutput("command") 来调用。
Apparently, such wrapper can be called via
ip.IP.getoutput("command")
.