import sys # \r is carriage return, writes the following text to the beginning of the line sys.stdout.write('\r')