What you're looking for is:
print("{}/100".format(k), "
", end="")
is carriage return, which returns the cursor to the beginning of the line. In effect, whatever is printed will overwrite the previous printed text. end=""
is to prevent
after printing (to stay on the same line).
A simpler form as suggested by sonrad10 in the comments:
print("{}/100".format(k), end="
")
Here, we're simply replacing the end character with
instead of
.
In Python 2, the same can be achieved with:
print "{}/100".format(k), "
",
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…