Printing repeatedly on same line
ajw126NO at SPAMyork.ac.uk
Sat Jan 25 17:18:50 CET 2003
Jason Morgan wrote:
> How do I print (stdout) to the same line repeatedly? I want to offer a
> status bar for a script. I have tried the following:
> def statprint(s): # s is a string
> import sys
> sys.stdout.write(s+" "*(78-len(s))+"\r")
> I got this from this ASPN page:
> which seemed to be refering to Windows (I'm writing for Linux/*BSD). I
> have tried the above function, but it prints in the same manner as
> 'print' does.
> Thanks for the help in advance.
Try just adding a semicolon at the end of the print statement.
will give you
More information about the Python-list