Is there go up line character? (Opposite of \n)

后端 未结 5 1218
暗喜
暗喜 2020-11-27 14:07

I would like to overwrite something on a line above in in a serial console. Is there a character that allows me to move up?

Thank you.

5条回答
  •  清酒与你
    2020-11-27 14:44

    for i in range(10):  
        print("Loading" + "." * i) 
    
        doSomeTimeConsumingProcessing()
    
        sys.stdout.write("\033[F") # Cursor up one lin
    

    Try this in Python and replace doSomeTimeConsumingProcessing() with any routine needed, and hope it helps

提交回复
热议问题