Skip to content

Instantly share code, notes, and snippets.

@santosh
Created March 25, 2013 09:18
Show Gist options
  • Select an option

  • Save santosh/5235922 to your computer and use it in GitHub Desktop.

Select an option

Save santosh/5235922 to your computer and use it in GitHub Desktop.
This script demonstrate the `flush` argument of print() function.
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from __future__ import print_function
from time import sleep
string = "The words in this sentence should appear letter by letter."
print("Please wait if you don't see another sentence appearing below.", end="\n\n")
for characters in string:
# If flush disabled the another line will appear at once and not char by char.
print(characters, end="", flush=True)
sleep(.1)
@jincminst
Copy link

I post a comment two years ago and now I get an email from github about this gist. Also that this gist was here in 2013.

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