[Python] Unprint a line on the console in Python?

Discussão em 'Python' iniciado por Stack, Abril 24, 2025.

  1. Stack

    Stack Membro Participativo

    Is it possible to manipulate lines of text that have already been printed to the console?

    For example,

    import time
    for k in range(1,100):
    print(str(k)+"/"+"100")
    time.sleep(0.03)
    #>> Clear the most recent line printed to the console
    print("ready or not here I come!")


    I've seen some things for using custom DOS consoles under Windows, but I would really like something that works on the command_line like does print without any additional canvases.

    Does this exist? If it doesn’t, why not?

    P.S.: I was trying to use curses, and it was causing problems with my command line behaviour outside of Python. (After erroring out of a Python script with curses in it, my Bash shell stopped printing newline -unacceptable- ).

    Continue reading...

Compartilhe esta Página