Skip to content

Instantly share code, notes, and snippets.

@alfasin
Last active August 31, 2020 06:41
Show Gist options
  • Save alfasin/8c4cf0733164d28a4b7c to your computer and use it in GitHub Desktop.
Save alfasin/8c4cf0733164d28a4b7c to your computer and use it in GitHub Desktop.
from __future__ import print_function
import time
import sys
for i in range(10, -1, -1):
print(str(i), end="\r")
sys.stdout.flush()
time.sleep(.4)
print('boom!')
@alfasin
Copy link
Author

alfasin commented Aug 31, 2020

print(str(i), end="\r")
sys.stdout.flush()

won't work well in Python 2 which is why we need to import print_function from __future__

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