But when I try to run it in my jupyter notebook (I run using cmd command jupyter notebook) I think sys.stdout.flush() not works, it show every printed iterations, not overwrite the previous one:Episode 1000/10000.Episode 2000/10000.Episode 3000/10000.Episode 4000/10000.Episode 5000/10000.Episode 6000/10000.Episode 7000/10000.Episode 8000/10000.Episode 9000/10000.Episode 10000/10000.运行jupyter使它正常工作时,我是否缺少某些东西?Am I missing something when run jupyter to make it works?推荐答案 Charless Duffy的注释使所有内容变得清晰.覆盖的问题不在打印功能中的冲洗功能上有效.Charless Duffy comment makes everything clear. The problem of overwriting is not on flush function buat in print function.我发现解决方案只是从以下位置编辑打印格式:I found the solution is just edit the print format from:print("\rEpisode {}/{}.".format(i_episode, num_episodes))到print("\rEpisode {}/{}.".format(i_episode, num_episodes), end="")并且覆盖现在可以正常工作and the overwrite works now 这篇关于sys.stdout.flush在jupyter笔记本中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-11 14:45