Study/Computer
python에서 line 줄바꿈없이 업데이트하기
Amor Natura
2014. 1. 23. 22:48
파이썬에서 print로 출력할 때, 줄바꿈 없이 print 내용이 업데이트하는 방법이다.
출처는 역시 스택오버플로우~!
t's called the carriage return, or \r
Use
print i/len(some_list)*100," percent complete \r",
The comma prevents print from adding a newline. (and the spaces will keep the line clear from prior output)
Also, don't forget to terminate with a print ""
to get at least a finalizing newline!
http://stackoverflow.com/questions/3419984/print-to-the-same-line-and-not-a-new-line-in-python