Progress count in terminal (Mac OS X)

Fredrik Lundh fredrik at pythonware.com
Thu Jan 11 09:22:07 EST 2007


Tommy Grav <tgrav at mac.com>:

>I have a program that does a lot of iterations and would like
> to follow its progress by having it print out the current iteration
> number as it progresses. How do I do this so that it appears
> like a counter that increases in the same place in the terminal
> window? I am using python2.5 on a Mac OSX and its terminal
> tcsh window.

print a carriage return before, and no line feed after, each line:

    for i in range(100):
        print "\r" + "count", i,
    print # done

</F> 






More information about the Python-list mailing list