title: Scanned Input in python as a single Input
body: <p>I have written this code where I process scanned input from barcode scanner. But input here are from single line and I can't get difference between the next scanned input and the past one. Here is my code:</p>
  
  <pre><code>from evdev import InputDevice, categorize, ecodes
  import select
  
  dev = InputDevice('/dev/input/event2')
  data = ""
  
  def parse_key_to_char(val):
      return CODE_MAP_CHAR[val] if val in CODE_MAP_CHAR else ""
  
  for event in dev.read_loop():
      if event.type == ecodes.EV_KEY:
          e = categorize(event)
          if e.keystate == e.key_up:
              print parse_key_to_char(e.keycode)
  </code></pre>
  
  <p>And the Output is:</p>
  
  <pre><code>0
  7
  5
  6
  7
  8
  1
  6
  4
  1
  2
  5
  </code></pre>
  
  <p>While expected output is : </p>
  
  <pre><code>075678164125
  </code></pre>
  
  <p>It works if I am in the same terminal but won't work if I am focusing on some other terminal. I want these inputs to be captured in the background and pass them to some other function which is calling current function.</p>