On 02/14/2015 07:51 AM, Steven D'Aprano wrote:
On Sat, Feb 14, 2015 at 06:40:56AM -0500, Dave Angel wrote:
On 02/14/2015 04:07 AM, Steven D'Aprano wrote:
On Sat, Feb 14, 2015 at 03:17:28AM +0000, steve10br...@comcast.net wrote:

[...]
for i in range (a):
     print i, '\r',
[...]

BUT I'm not sure why you are worried about making it more concise when
your code doesn't do what you want, as far as I can tell. You want the
counter to be written on the same line, not 640 thousand lines, but when
I try it, I get each number written to a different line.

That's probably because you've dropped the trailing comma that the OP
used in the print statements.

So I did :-(

Have I mentioned recently just how awesome Python 3's print is?

for i in range(100000):
     print(i, end='\r')

Much nicer :-)



Agreed. But don't you need " \r" so when you're counting down you don't have the trailing crud? The space was implicit on Python 2, because it mistakenly thought the code was printing two elements.


--
DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to