Printing/updating output to the screen
Daniel Ehrenberg
LittleDanEhren at yahoo.com
Thu Jan 29 17:07:25 EST 2004
Daniel Pryde <dpryde+usenet at cis.strath.ac.uk> wrote in message news:<40192945$1 at nntphost.cis.strath.ac.uk>...
> Hi there. I hope this isn't a stupid question to ask, but does anyone
> know how to print out a string without moving to a new line each time
> and simply updating the first line. An example would be, if I wanted to
> have a percentage progress counter that was constantly updating. I'm
> unsure how to do this without printing to a brand new line. Any help
> would be greatly appreciated. Thanks.
>
> Daniel
Put a comma after it. For example:
print "hi",
This, however, also prints a space. If that's not what you want, do the following:
from sys import stdout
stdout.write("hi")
That won't append a space or a newline.
Another Daniel
More information about the Python-list
mailing list