print without newline "halts" program execution

Karlo Lozovina _karlo_ at _mosor.net_
Sat Apr 15 21:45:30 EDT 2006


Jay Parlar <jparlar at cogeco.ca> wrote in 
news:mailman.4537.1144976780.27775.python-list at python.org:

> Your problem is that the 'print' statement is sending the text to 
> sys.stdout, and sys.stdout is buffered.

I thought it was something like this, but I couldn't find it in the docs :
(.

> print 'Start: %f,'% st,
> sys.stdout.flush()
> sleep(10)
> sp = time()
> print 'Stop: %f, Duration: %f' % (sp, (st-sp))

This works excellent, *thank* you.

> There are other ways to do this, but try this:

And for purely academical purposes, what are those other ways to do it? 
I'm curious :).

-- 
 _______                                        Karlo Lozovina - Mosor
|   |   |.-----.-----.     web: http://www.mosor.net || ICQ#: 10667163
|       ||  _  |  _  |             Parce mihi domine quia Dalmata sum.
|__|_|__||_____|_____|



More information about the Python-list mailing list