help with printing to stdout...

2009-03-08 Thread Daniel Dalton
Hi, I've got a program here that prints out a percentage of it's completion. Currently with my implimentation it prints like this: 0% 1% 2% 3% 4% etc taking up lots and lots of lines of output... So, how can I make it write the percentage on the same line eg. while working: print percent

Re: help with printing to stdout...

2009-03-08 Thread Chris Rebert
On Sun, Mar 8, 2009 at 1:37 AM, Daniel Dalton d.dal...@iinet.net.au wrote: Hi, I've got a program here that prints out a percentage of it's completion. Currently with my implimentation it prints like this: 0% 1% 2% 3% 4% etc taking up lots and lots of lines of output... So, how can I

Re: help with printing to stdout...

2009-03-08 Thread D'Arcy J.M. Cain
On Sun, 8 Mar 2009 01:59:03 -0800 Chris Rebert c...@rebertia.com wrote: etc taking up lots and lots of lines of output... So, how can I make it write the percentage on the same line eg. Use the carriage return character to overwrite the line (you'll need to forego `print`): Why do you say

Re: help with printing to stdout...

2009-03-08 Thread Hendrik van Rooyen
Daniel Dalton d.dal...@iinet.net.au wrote: I've got a program here that prints out a percentage of it's completion. Currently with my implimentation it prints like this: 0% 1% 2% 3% 4% etc taking up lots and lots of lines of output... So, how can I make it write the percentage on the

Re: help with printing to stdout...

2009-03-08 Thread Lie Ryan
Chris Rebert wrote: On Sun, Mar 8, 2009 at 1:37 AM, Daniel Dalton d.dal...@iinet.net.au wrote: Hi, I've got a program here that prints out a percentage of it's completion. Currently with my implimentation it prints like this: 0% 1% 2% 3% 4% etc taking up lots and lots of lines of output...

Re: help with printing to stdout...

2009-03-08 Thread Daniel Dalton
or like this: print '\r'+str(percent), Then make sure it gets sent out, like this: sys.stdout.flush() Hey! Thanks very much, that did the trick! Thanks to everyone that replied, I discovered converting to str was crutial to actually print anything. :) Cheers, Daniel. --