How to turn a string into a list of integers?
Joshua Landau
joshua at landau.ws
Thu Sep 4 17:06:23 EDT 2014
More information about the Python-list mailing list
Thu Sep 4 17:06:23 EDT 2014
- Previous message (by thread): How to turn a string into a list of integers?
- Next message (by thread): How to turn a string into a list of integers?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3 September 2014 15:48, <cl at isbd.net> wrote: > Peter Otten <__peter__ at 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.
- Previous message (by thread): How to turn a string into a list of integers?
- Next message (by thread): How to turn a string into a list of integers?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list