[Tutor] Sleeping it out
Alan Gauld
alan.gauld at btinternet.com
Sun Dec 9 01:38:25 CET 2007
"Eric Brunson" <brunson at brunson.com> wrote
> Yes, import sys, then sys.stdout.flush() when you need it.
This was my initial idea but it doesn't work in the IDE because
it is not really using sys.stdout. In fact the normal print works
fine from the command prompt (at least in XP)
Alan G.
Ricardo Aráoz wrote:
> Hi, I have this code :
>
> import time
> L = [i for i in xrange(20)]
> for n, i in enumerate(L) :
> if n%3 == 0 and n > 0 :
> print 'waiting 3 seconds'
> time.sleep(3)
> print i
>
> I'm using Py 2.51 and PyAlaMode. It works ok but instead of printing
> in
> groups of three, it will go through the program but the printing
> will
> appear all at once at the end of the loop. Is there any way to flush
> the
> output?
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list