print before sleep in python
Ahmed MOHAMED ALI
removeahmed.mohamed.edigramremove at wanadoo.frremove
Tue Dec 23 04:38:45 EST 2003
Hi avik,
it works for me.Here's the code that i tried
>>> import time
>>> def test_sleep():
>>> print "before sleep"
>>> time.sleep(5)
>>> print "after sleep"
>>> test_sleep()
>>> before sleep
and after the period
>>> after sleep
"Avik Ghose" <avik at rebaca.com> wrote in message
news:32098fec.0312222255.655750c3 at posting.google.com...
> Hi All,
> What I am trying to acheive is very simple. I want to print something
> to the screen(sys.stdout) and then go to sleep (time.sleep) for a some
> duration. Now, I want the thread to print the message first and then
> go to sleep. But what actually happens is that it prints after coming
> back to ready state. I have tried to flush the stdout
> (sys.stdout.flush) but it did not work. I hope many of you will be
> able to help me out. Thanks a lot in advance.
> Regards,
> Avik
More information about the Python-list
mailing list