title: pyserial - how to continuously read and parse
body: <p>I'm trying to capture data from a hardware device that's connected via usb to my linux computer that's running ubuntu. Here's the very simple script I currently have:</p>
  
  <pre><code>import serial
  ser = serial.Serial('/dev/ttyUB0', 9600)
  s = ser.read(10000)
  print(s)
  </code></pre>
  
  <ol>
  <li>How do I make this print continuously? </li>
  <li>The data is coming through in hexadecimal which I'd like to interpret. Should I have the continuous data save to a text file and then have another script analyze? Essentially, I'm trying to build a sniffer to grab the data and interpret. </li>
  </ol>
  
  <p>Thanks for your help! I'm a newbie :) </p>