Duncan Booth wrote:
> Laurent Pointal <[EMAIL PROTECTED]> wrote:
>
>> You may eventually use a more condensed expression and avoid n
>> concatenation of n chars using join, like this:
>>
>> >>> u''.join(unichr(int(x,16)) for x in ['42','72','61','64'])
>> u'Brad'
>
> Or even avoid the loop completely:
>
>>>> hexs = ['42', '72', '61', '64']
>>>> u'\\x'.join(['']+hexs).decode('string-escape')
> 'Brad'
>
> (but for that to work you really do need to be sure that all the values are
> 2 characters).
Or
>>> "".join(['42', '72', '61', '74']).decode("hex").decode("latin1")
u'Brat'
(same caveat)
Peter
--
http://mail.python.org/mailman/listinfo/python-list