Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. import sys, select, time
  2. currentTime = time.time()
  3. inputFD = [sys.stdin]
  4. while True:
  5.     read, out, excep = select.select(inputFD, [], [])
  6.     for s in read:
  7.         if s == sys.stdin:
  8.             print sys.stdin.readline()
  9.     newTime = time.time()
  10.     if newTime - currentTime > 3:
  11.         print 'non-blocking input'
  12.         currentTime = newTime
  13.     time.sleep(0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement