multiple prints on the same line in Python

前端 未结 17 2474
独厮守ぢ
独厮守ぢ 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:24

    You can simply use this:

    print 'something',
    ...
    print ' else',
    

    and the output will be

    something else
    

    no need to overkill by import sys. Pay attention to comma symbol at the end.

    Python 3+ print("some string", end=""); to remove the newline insert at the end. Read more by help(print);

提交回复
热议问题