How to read from serial port?

Ben Finney ben+python at benfinney.id.au
Tue Apr 26 21:27:36 EDT 2016


Gonzalo V <gvm2121 at gmail.com> writes:

> Try print('blaba'+str(out))

I doubt that gives the desired result for a bytes object. Did you try it?

    >>> foo = b'\xde\xad\xbe\xef'
    >>> str(foo)
    "b'\\xde\\xad\\xbe\\xef'"
    >>> print(str(foo))
    b'\xde\xad\xbe\xef'

Yes, the “b'” and backslashes are all part of the output.

> saludos,
> desde un móvil.

Please don't top-post. If that means you need to wait until you are at a
device with proper keyboard, then please do that.

-- 
 \           “I have one rule to live by: Don't make it worse.” —Hazel |
  `\                                                          Woodcock |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list