Skip to content

Instantly share code, notes, and snippets.

@enric1994
Created November 9, 2018 14:51
Show Gist options
  • Save enric1994/cbff27cefb90f28dfaf323ae00536700 to your computer and use it in GitHub Desktop.
Save enric1994/cbff27cefb90f28dfaf323ae00536700 to your computer and use it in GitHub Desktop.
Print stuff in Python 2.7 always in the same line using carriage return
import sys,time
for i in xrange(100):
time.sleep(1)
sys.stdout.write('\r One line print! ' + str(i))
sys.stdout.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment