Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys, select, time
- currentTime = time.time()
- inputFD = [sys.stdin]
- while True:
- read, out, excep = select.select(inputFD, [], [])
- for s in read:
- if s == sys.stdin:
- print sys.stdin.readline()
- newTime = time.time()
- if newTime - currentTime > 3:
- print 'non-blocking input'
- currentTime = newTime
- time.sleep(0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement