【发布时间】:2016-05-11 00:39:58
【问题描述】:
我正在尝试从 ipython notebook 运行 python 程序。如果在命令下面运行它是 works.
run twitterstream.py >> output.txt
但是,如果使用 while 循环运行 它会失败。不知道为什么会失败?
import time
t_end = time.time() + 60 * 3
while time.time() < t_end:
print ('entered')
run twitterstream.py >> output.txt
语法错误:
File "<ipython-input-28-842e0185b3a8>", line 5
run twitterstream.py >> output.txt
^
SyntaxError: invalid syntax
【问题讨论】:
-
twitterstream.py 到底在做什么?
-
它从 twitter 收集推文。