multiple prints on the same line in Python

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

    sys.stdout.write will print without return carriage

    import sys
    sys.stdout.write("installing xxx")
    sys.stdout.write(".")
    

    http://en.wikibooks.org/wiki/Python_Programming/Input_and_output#printing_without_commas_or_newlines

提交回复
热议问题