Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107698

Re: How to read from serial port?

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: How to read from serial port?
Date 2016-04-27 11:27 +1000
Message-ID <mailman.136.1461720464.32212.python-list@python.org> (permalink)
References <41302A7145AC054FA7A96CFD03835A0A0BAC66F9@EX10MBX02.EU.NEC.COM> <nfoc30$cr8$1@ger.gmane.org> <CAF40P_3rE3QCQm6dLACd=14W5e+UB5rjBArO=q1BNq8MzEtV9g@mail.gmail.com> <85k2jjlu2f.fsf@benfinney.id.au>

Show all headers | View raw


Gonzalo V <gvm2121@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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: How to read from serial port? Ben Finney <ben+python@benfinney.id.au> - 2016-04-27 11:27 +1000
  Re: How to read from serial port? wxjmfauth@gmail.com - 2016-04-27 00:26 -0700

csiph-web