multiple prints on the same line in Python

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

    Python appends newline as an end to print. Use end=' ' for python3 for print method to append a space instead of a newline. for python2 use comma at end of print statement.

    print("Foo",end=' ')
    print('Bar')
    
    

提交回复
热议问题