decimal to string conv

2009-02-27 Thread Aj
Hi all,

I am trying to convert a list to string.
example [80, 89,84,72,79,78,0] is my input. I could make it to just
[0x50,0x59,0x54,0x48,0x4F,0x4E,0x00].
but I wanted it to be like PYTHON.
I couldnt even convert 0x50 to 'P'. Is there any library api available
to do this? it will be really helpful to me.
dont bang me if its already being asked. I just 'dived' into python
yesterday.

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


Re: decimal to string conv

2009-02-27 Thread Chris Rebert
On Fri, Feb 27, 2009 at 1:45 AM, Aj aru...@gmail.com wrote:
 Hi all,

 I am trying to convert a list to string.
 example [80, 89,84,72,79,78,0] is my input. I could make it to just
 [0x50,0x59,0x54,0x48,0x4F,0x4E,0x00].
 but I wanted it to be like PYTHON.
 I couldnt even convert 0x50 to 'P'. Is there any library api available
 to do this? it will be really helpful to me.

lst = [80, 89,84,72,79,78,0]
print ''.join(map(chr, lst[:-1]))

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: decimal to string conv

2009-02-27 Thread Aj
On Feb 27, 10:58 am, Chris Rebert c...@rebertia.com wrote:
 On Fri, Feb 27, 2009 at 1:45 AM, Aj aru...@gmail.com wrote:
  Hi all,

  I am trying to convert a list to string.
  example [80, 89,84,72,79,78,0] is my input. I could make it to just
  [0x50,0x59,0x54,0x48,0x4F,0x4E,0x00].
  but I wanted it to be like PYTHON.
  I couldnt even convert 0x50 to 'P'. Is there any library api available
  to do this? it will be really helpful to me.

 lst = [80, 89,84,72,79,78,0]
 print ''.join(map(chr, lst[:-1]))

 Cheers,
 Chris

 --
 Follow the path of the Iguana...http://rebertia.com

wow... that was quick and it works perfect with my inputs.
thanx  have a nice day.

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