python - print(flush = True) function return confused output in jupyter notebook - Stack Overflow

My string list is ['I',"'m using",'.nnI should',' explain

My string list is ['I',"'m using",'.\n\nI should',' explain',' that']. I run this command in my Jupyter-lab notebook(Version 4.3.4):

for c in string:
    print(c, end = '',flush = True)

Output is:

I'm using.

 explain that

You can see "\n" is black marked. But python3 compiler (Version 3.10.12) return the right output. When I use a different Jupyter-lab kernel it also works well.

I think this might be due to Jupyter-lab. So how to fix it and get the same output? Thanks!

I view some document about jupyter-lab. I am sure that there no typos.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744993796a4605063.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信