Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # thread_timer.py
- from threading import Timer
- import time
- go=True
- def timeout():
- global go
- go=False
- t = Timer(5, timeout)
- t.start()
- # do something else, such as...
- i=0
- while go:
- print i,'\t',
- i+=1
- print '\n... Bye!'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement