How about:
ord=''.join([unichr(int(x,16)) for x in hexs])
I don't know if its faster, but I'll bet it is.
-Larry
[EMAIL PROTECTED] wrote:
> Here's how I'm doing this right now, It's a bit slow. I've just got
> the code working. I was wondering if there is a more efficient way of
> doing this...
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 com
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',
On Sep 24, 2:42 pm, [EMAIL PROTECTED] wrote:
> Here's how I'm doing this right now, It's a bit slow. I've just got
> the code working. I was wondering if there is a more efficient way of
> doing this... simple example from interactive Python:
>
> >>> word = ''
> >>> hexs = ['42', '72', '61', '64']
[EMAIL PROTECTED] a écrit :
> Here's how I'm doing this right now, It's a bit slow. I've just got
> the code working. I was wondering if there is a more efficient way of
> doing this... simple example from interactive Python:
>
word = ''
hexs = ['42', '72', '61', '64']
for h in hexs
Here's how I'm doing this right now, It's a bit slow. I've just got
the code working. I was wondering if there is a more efficient way of
doing this... simple example from interactive Python:
>>> word = ''
>>> hexs = ['42', '72', '61', '64']
>>> for h in hexs:
... char = unichr(int(h, 16))
...