Re: Converting numbers to unicode charaters

2007-09-24 Thread Larry Bates
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...

Re: Converting numbers to unicode charaters

2007-09-24 Thread Peter Otten
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

Re: Converting numbers to unicode charaters

2007-09-24 Thread Duncan Booth
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',

Re: Converting numbers to unicode charaters

2007-09-24 Thread Paul Hankin
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']

Re: Converting numbers to unicode charaters

2007-09-24 Thread Laurent Pointal
[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

Converting numbers to unicode charaters

2007-09-24 Thread byte8bits
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)) ...