Tribhuvanesh Orekondy bio photo

Tribhuvanesh Orekondy

Grad Student, Hacker, Wanderer

Email Twitter Github

Want to display progress status, without additional packages or dependendies? Here’s a simple solution:

print ''
for idx in range(num_rows):
  vec = X[idx]
  process(vec)
  if idx % 100 == 0:
    print '\rProcessed %d/%d (%.2f%%)' % (idx+1, num_rows, (idx+1)*100.0/num_rows)

The \r moves the carriage to the beginning and overwrites the previous progress line.