更新时间:2023-09-23 12:13:28
shell模式从字面上解释所有内容(否则 cmd.py
也会被评估)。我会这么做:
the shell mode interprets everything literally (else cmd.py
would be evaluated as well). I would just do:
for i in range(5):
%run cmd.py $i
来自 http://ipython.readthedocs.io/en/stable/interactive/reference.html
IPython还允许您在进行系统调用时扩展python变量的值。在{braces}中包装变量或表达式:
IPython also allows you to expand the value of python variables when making system calls. Wrap variables or expressions in {braces}:
对于简单的情况,您也可以将$添加到变量名称
For simple cases, you can alternatively prepend $ to a variable name