Created
July 22, 2012 22:42
-
-
Save lennax/3161269 to your computer and use it in GitHub Desktop.
Updating a single printed line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import time | |
spinner = ["-", "\\", "|", "/"] | |
print "This is the header row" | |
try: | |
for i in range(10): | |
sys.stdout.flush() | |
sys.stdout.write("\r%s %2d%%" % (spinner[i%4], i)) | |
time.sleep(1) | |
except KeyboardInterrupt: | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment