Reading a line from an Arduino with pyserial gives me b'23.5\r\n' instead of 23.5. Comparing it with a string fails, line == "23.5" is always False, and "Temp: " + line raises TypeError: can only concatenate str (not "bytes") to str. Wrapping it in str(line) gives the text b'23.5\r\n' with the b and the quotes included.
What is the difference between bytes and str in Python 3, how do I convert properly, and what should I do when the device sometimes sends garbage bytes?




