multiple prints on the same line in Python

前端 未结 17 2517
独厮守ぢ
独厮守ぢ 2020-11-22 06:06

I want to run a script, which basically shows an output like this:

Installing XXX...               [DONE]

Currently, I print Installi

17条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 06:14

    Most simple:

    Python 3

        print('\r' + 'something to be override', end='')
    

    It means it will back the cursor to beginning, than will print something and will end in the same line. If in a loop it will start printing in the same place it starts.

提交回复
热议问题