chr / ord

Sean McIlroy sean_mcilroy at
Tue Nov 3 20:40:21 CET 2009

thanks. that did the trick. in case anyone else is in the same boat as
myself, here are the relevant correspondences:

string <-> [int]                                 bytes <-> [int]

lambda string: [ord(x) for x in string]           list
lambda ints: ''.join([chr(x) for x in ints])      bytes

More information about the Python-list mailing list