所以我只想从这个回购中重新运行代码: https://github.com/dennybritz/reinforcement-learning/blob/master/MC/MC%20Prediction%20Solution.ipynb
我的重点是印刷品部分:
for i_episode in range(1, num_episodes + 1):
# Print out which episode we're on, useful for debugging.
if i_episode % 1000 == 0:
print "\rEpisode {}/{}.".format(i_episode, num_episodes)
sys.stdout.flush()
他正在使用系统stdout.flush()创建一个简单的“进度”输出。{1}你只能从最后一集的cdrepo>中看到它系统stdout.flush()
但当我试图在我的jupyter笔记本中运行它时(我使用cmd命令jupyter notebook
)我想系统stdout.flush()不起作用,它显示每个打印的迭代,不覆盖上一个:
我是不是在运行jupyter时遗漏了什么?在
毫无生气的达菲的评论让一切都很清楚。覆盖的问题不在print函数的flush函数buat上。在
我发现解决方法是从以下位置编辑打印格式:
到
^{pr2}$覆盖现在起作用了
相关问题 更多 >
编程相关推荐