Bengt Richter wrote: > On Thu, 11 Aug 2005 15:43:23 -0400, Darren Dale <[EMAIL PROTECTED]> wrote: > >>Peter Hansen wrote: >> >>> Darren Dale wrote: >>>> Is there a module somewhere that intelligently deals with reports to >>>> the command line? I would like to report the progress of some pretty >>>> lengthy simulations, and currently I have the new reports written on a >>>> new line rather rather than overwriting the previous report. >>> >>> You mean you want sys.stdout.write(report + '\r') instead of "print >>> report" ? >>> >>> It's not really clear what you want. What's a "report" to you? >>> >>> -Peter >> >>I am printing something like >> >>trial 1 of 100 >>trial 2 of 100 >>... > Peter's suggestion will work, but it's easy to get something like > > >>> import sys, time > >>> def test(): > ... for i in xrange(5): > ... sys.stdout.write(('trial %s of 5'%(i+1)) + '\r') > ... time.sleep(.25) > ... print "We're done!" > ... > >>> test() > We're done!
Thanks, I didnt realize that \r is different from \n. -- http://mail.python.org/mailman/listinfo/python-list