파이썬의 print() 함수에서 줄바꿈 없이 같은 자리에 겹쳐서 출력하기
파이썬의 print() 함수로 화면에 출력할 때 줄바꿈이 없이 같은 자리에 계속 출력하도록 할 수 있습니다. print()의 end 옵션을 지정하면 출력후 마지막에 어떤 값을 붙일 것인지를 설정할 수 있는데 이것을 줄바꿈(\n)이 아니라 되돌아가기(\r)로 하면 됩니다. end 옵션을 지정하지 않을 경우 기본값은 줄바꿈입니다.
아래의 예시를 보면 쉽게 알 수 있습니다. 1초 간격으로 0부터 14까지 같은 자리에 출력을 하는 경우입니다.
import time
for i in range(15):
time.sleep(1)
print(i, end='\r')
print('완료')
@joviansummer의 스팀 프로젝트
스팀 증인노드를 운영중입니다. @jswit에 증인투표해 주시면 감사하겠습니다.
(https://steemitwallet.com/~witnesses)
jsup 서비스에 큐레이션 보상 분배 기능이 추가되었습니다.
jSTEEM 프로젝트 - 텔레그램 챗봇으로 구현하는 스팀 블럭체인 탐색기
Posted through the AVLE Dapp (https://avle.io)
Thank you, friend!


I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
please click it!
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)
The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.