Skip to content

Instantly share code, notes, and snippets.

@ozcanyarimdunya
Last active January 7, 2023 10:24
Show Gist options
  • Save ozcanyarimdunya/93f4d854103d1531c9aa951cd3a92958 to your computer and use it in GitHub Desktop.
Save ozcanyarimdunya/93f4d854103d1531c9aa951cd3a92958 to your computer and use it in GitHub Desktop.
itertools cycle example
import itertools
import time
cycle = itertools.cycle(['-', '/', '|', '\\'])
for i in range(5):
print("Loading", next(cycle), end="\r")
time.sleep(.5)
print("Finished!")
cycle = itertools.cycle(['.', '..', '...', '....'])
for i in range(5):
print("Waiting", next(cycle), f"{'':<5}", end="\r")
time.sleep(.5)
print("Finished!")
@ozcanyarimdunya
Copy link
Author

sample

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment