Created
December 3, 2017 15:22
-
-
Save milo0/494148ec32647532646f73ffffaeb4bf to your computer and use it in GitHub Desktop.
Spinning cursor
This file contains 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
import itertools, sys | |
from time import sleep | |
spinner = itertools.cycle(['|', '/', '-', '\\']) | |
while True: | |
sys.stdout.write(next(spinner)) # write the next character | |
sys.stdout.flush() # flush stdout buffer (actual character display) | |
sys.stdout.write('\b') # erase the last written char | |
sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment