title: Python Serial: How to use the read or readline function to read more than 1 character at a time
body: <p>I'm having trouble to read more than one character using my program, I can't seem to figure out what went wrong with my program.</p>
  
  <pre><code>import serial
  
  ser = serial.Serial(
      port='COM5',\
      baudrate=9600,\
      parity=serial.PARITY_NONE,\
      stopbits=serial.STOPBITS_ONE,\
      bytesize=serial.EIGHTBITS,\
          timeout=0)
  
  print("connected to: " + ser.portstr)
  count=1
  
  while True:
      for line in ser.read():
  
          print(str(count) + str(': ') + chr(line) )
          count = count+1
  
  ser.close()
  </code></pre>
  
  <p>here are the results I get</p>
  
  <pre><code>connected to: COM5
  1: 1
  2: 2
  3: 4
  4: 3
  5: 1
  </code></pre>
  
  <p>actually I was expecting this</p>
  
  <pre><code>connected to: COM5
  1:12431
  2:12431
  </code></pre>
  
  <p>something like the above mentioned which is able read multiple characters at the same time not one by one.</p>