[Python] print(flush=True) function can not print string like '\n\n str' in my Jupyter-lab...

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

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

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


    Output is:

    I'm using.

    explain that


    enter image description here

    You can see "\n" is black marked. But when I use a different Jupyter-lab kernel it works well. enter image description here

    So how to fix it and get the same output? Thanks!

    Continue reading...

Compartilhe esta Página