3

IPython 0.13.1 文档说:

$ ipython -h
...
Usage

    ipython [subcommand] [options] [files]

    If invoked with no options, it executes all the files listed in sequence
    and exits, use -i to enter interactive mode after running the files.
...

我有两个文件foo.pybar.py.

foo.py

print "Hi, I'm foo."

bar.py

print "Hi, I'm bar."

我希望以下内容以相应的顺序打印两个文件输出。相反,我只从命令行上给出的第一个文件中获取输出。

$ ipython foo.py bar.py
Hi, I'm foo.

$ ipython bar.py foo.py
Hi, I'm bar.

这是实现错误、文档错误还是用户误解?如果是后者,我应该怎么做?

4

1 回答 1

2

这是文档失败,由此 Pull Request修复。命令

$> ipython [-i] script.py script2.py ...

行为与命令完全相同

$> python [-i] script.py script2.py ...

其中, script.py 运行,使用sys.argvof ['script.py', 'script2.py', '...'],如果-i指定,它在运行脚本后进入交互式会话。

于 2013-03-25T00:28:37.903 回答