title: Control a COGNEX Barcode Scanner via RS-232
body: <p>I have a RS-232 Barcode scanner. I'm using a serial port to communicate with the instrument, I don't have a problem communicating with the instrument, the problem I have is that every time I read the scanner response, exist this "extra characters" that I need to remove from my string. I think could be because the way I'm reading the response? </p>
  
  <p>This is what i read from the scanner: "b'0937J094ZP'"
  When in theory, the scanner should read only "0937J094ZP" </p>
  
  <p>Do not why the string has an "b" and " ' " </p>
  
  <pre><code>cognex = serial.Serial('COM4', 9600, timeout=5)
  time.sleep(.5)
  cognex.write(b'0')
  time.sleep(1)
  response = cognex.read(10)
  cognexsn = response
  print(cognexsn)
  &gt;&gt;&gt;b'0937J094ZP'
  </code></pre>
  
  <p>Thanks for stop by and your help is appreciate. </p>