有没有办法从一个%%bash或其他%%script单元格中访问当前python内核中的变量?
%%bash
%%script
也许作为命令行参数或环境变量?
ipython-notebook ipython-magic
如何从Ipython/Jupyter笔记本执行bash命令,将python变量的值作为参数传递,如下例所示:
py_var="foo" !grep py_var bar.txt
(显然我想要grep foo而不是文字字符串py_var)
foo
py_var
python ipython command-line-arguments jupyter-notebook
command-line-arguments ×1
ipython ×1
ipython-magic ×1
ipython-notebook ×1
jupyter-notebook ×1
python ×1