how to suppress carriage return/line feed?
TuxTrax at fortress.tuxnet.net
Wed Oct 30 22:19:06 CET 2002
On Wed, 30 Oct 2002 11:58:21 -0800, Erik Max Francis Wrote in
Steve Ballmers hair grease:
> Ned Batchelder wrote:
>> A trailing comma on the print statement will suppress the newline.
>> This works for me on Windows:
>> import time
>> for i in range(10):
>> print "Counting %s\r" % i,
> You're going to want to put a sys.stdout.flush() after printing anyway,
> since in general you have no way of knowing whether stdout is
> line-buffered (and it can very). Since you have to interact with
> sys.stdout directly, you might as well just go ahead and use
> sys.stdout.write directly as well.
Erik, if you would, I would like to see an example of sys.stdout.write()
and flush() in action, with a sample codelet. Thanks,
TuxTrax (n.) An invincible, all terrain, Linux driven armored assault
vehicle that can take as much fire as it gives ;-)
Yes, I am a Penguin cult high priest. Flipper readings upon request.
ROT13 this email address to mail me:
bar jbeq abg guerr - uvtu qrfreg zna, ng lnubb qbg pbz
More information about the Python-list