On Mon, 31 Jan 2005 18:01:59 -0600, Victor Rex [EMAIL PROTECTED] wrote:
I played around with this output issue and I love the way it works.
Now, how do you do this in *nix? I tried the same approach and I get a
blank line for 5 seconds (or whatever number of cycles you have on your
example)
Michael Janssen wrote:
On Mon, 31 Jan 2005 18:01:59 -0600, Victor Rex [EMAIL PROTECTED] wrote:
I played around with this output issue and I love the way it works.
Now, how do you do this in *nix? I tried the same approach and I get a
blank line for 5 seconds (or whatever number of cycles you
Orri Ganel wrote:
Jacob S. wrote:
Thanks Kent and Max!
Wow, I didn't know it did that. I'm too dumb to figure it out on my
own I guess...
Oh well! I found a cool new thing to play with at least!
Thanks,
Jacob
On Jan 30, 2005, at 02:40, Jacob S. wrote:
I don't think that's what he wants. I
Victor Rex wrote:
I played around with this output issue and I love the way it works.
Now, how do you do this in *nix? I tried the same approach and I get a
blank line for 5 seconds (or whatever number of cycles you have on your
example) and the a final line with the last value of the iterable.
print Percent completed: + str(percent) + \r
Which should send me back to the beginning of the line and overwrite
it
with a new line. But instead I get:
Percent completed: 50
Percent completed: 51
Print always adds a newline unless you put a comma at the end.
Unfortunately that results in
Hello,
I'm trying to have a loop in a program print a message so I know it's
status. Right now I'm using
print Percent completed: + str(percent) + \r
Which should send me back to the beginning of the line and overwrite it
with a new line. But instead I get:
Percent completed: 50
Percent
print Percent completed: + str(percent) + \r
Print forces a newline.
Try sys.stdout.write instead.
Alan
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Jan 30, 2005, at 02:18, R. Alan Monroe wrote:
print Percent completed: + str(percent) + \r
Print forces a newline.
Try sys.stdout.write instead.
Alan
You can also use the following syntax:
print Percent completed:, str(percent), \r,
The trailing comma is NOT a typo, it is intentional. It
I don't think that's what he wants. I think he wants to *overwrite* what's
in the shell with new output.
For example.
Python 2.4 (#Stuff)
...
Percent complete: 50
becomes...
Python2.4(#Stuff)
...
Percent complete: 51
so that the whole line is overwritten. In my experience, this is not
It seems to work fine in Win2k command shell; try this:
import time
time.sleep(1)
for i in range(9):
... print 'i is', i, '\r',
... time.sleep(1)
I get all the output on one line.
Kent
Jacob S. wrote:
I don't think that's what he wants. I think he wants to *overwrite*
what's in the
Thanks Kent and Max!
Wow, I didn't know it did that. I'm too dumb to figure it out on my own I
guess...
Oh well! I found a cool new thing to play with at least!
Thanks,
Jacob
On Jan 30, 2005, at 02:40, Jacob S. wrote:
I don't think that's what he wants. I think he wants to *overwrite*
11 matches
Mail list logo