I have the following simple code:
import sys
num_tasks = 1000000
for i in range(num_tasks):
if ((i/(num_tasks-1)) % 5):
sys.stderr.write('\rdone {0:.0%}'.format(i/(num_tasks-1)))
My problem is that i just want to show the 5% steps like:
done 5%, done 10%, done 15%,...
What am i doing wrong?
Aucun commentaire:
Enregistrer un commentaire