0

Hi All

I think this is my post in DW . I need a help from you guys .
I have a data

['\x1a', '\x05']

, and how i can convert this to ascii ??
Any ideas , please give a hint :)

thanks

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by vegaseat
0

Hint:
ord('\x1a')=26
ord('\x05')=5

ord() is a built-in function which returns the ASCII value of the passed charachter.

Edit: @ vegaseat:

#python 2.5.2
>>> c="%s" % '\x1a'
>>> c
'\x1a'
>>> print c
                            #nothing gets printed
0

Like I said ...

>>> c = "%s" % '\x1a'
>>> c
'\x1a'

or

>>> c = chr(ord('\x1a'))
>>> c
'\x1a'

.. since c is not a printable character.
However ...

>>> c = "%s" % '\x41'
>>> c
'A'
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.