On Fri, Sep 5, 2014 at 7:06 AM, Joshua Landau <jos...@landau.ws> wrote:
> On 3 September 2014 15:48,  <c...@isbd.net> wrote:
>> Peter Otten <__pete...@web.de> wrote:
>>> >>> [ord(c) for c in "This is a string"]
>>> [84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 115, 116, 114, 105, 110, 103]
>>>
>>> There are other ways, but you have to describe the use case and your Python
>>> version for us to recommend the most appropriate.
>>>
>> That looks OK to me.  It's just for outputting a string to the block
>> write command in python-smbus which expects an integer array.
>
> Just be careful about Unicode characters.

If it's a Unicode string (which is the default in Python 3), all
Unicode characters will work correctly. If it's a byte string (the
default in Python 2), then you can't actually have any Unicode
characters in it at all, you have bytes; Py2 lets you be a bit sloppy
with the ASCII range, but technically, you still have bytes, not
characters..

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to