Skip to content

Instantly share code, notes, and snippets.

@vsergeyev
Created November 19, 2024 07:59
Show Gist options
  • Save vsergeyev/6fd8c28c114cf825eb2460583b12df29 to your computer and use it in GitHub Desktop.
Save vsergeyev/6fd8c28c114cf825eb2460583b12df29 to your computer and use it in GitHub Desktop.
CLI SPINNER PYTHON
import sys
spinner = cycle(['|', '/', '-', '\\'])
while SOMETHING_IN_PROGRESS:
sys.stdout.write(f"\r{' ' * 50}\r") # Clear the line
sys.stdout.write(f"{next(spinner)} Status: {status}")
sys.stdout.flush()
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment