Created
October 22, 2015 14:41
-
-
Save habi/78132d37734861ae8d81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import numpy # not really needed for the printing, but for nice percentage :) | |
import sys | |
print 'Ciao Fede' | |
print 'Here is a percentage, on the same line' | |
for i in numpy.arange(0, 100, 0.1): | |
print '\r', # Comma is needed. | |
print 'Doing something. I am now %s%% done' % i, # Comma is needed | |
time.sleep(0.01) | |
sys.stdout.flush() # Might be needed depending on Python installation | |
print '\nThat was nice!' # We need to start a new line with the next 'print' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment