[Tutor] stop a loop after precise amount of time

Saad Javed sbjaved at gmail.com
Sun Nov 25 12:17:47 CET 2012


import time

running = True
while running:
    print 'yes'
    time.sleep(10)

This will print 'yes' after every 10s. I want to print 'yes' for 10s, then
quit.

Saad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121125/dc373ebf/attachment.html>


More information about the Tutor mailing list