Francois De Serres wrote:
> hiho,
> 
> what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to 
> the string 'spam'?

one way is to use a list expression:

 >>> ''.join([chr(c) for c in (0x73, 0x70, 0x61, 0x6D)])
'spam'

another is to use map:

 >>> ''.join(map(chr, (0x73, 0x70, 0x61, 0x6D)))
'spam'

HTH,
deelan.

-- 
deelan, #1 fan of adriana lima!
<http://www.deelan.com/>




-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to