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
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
The values you gave are not really printable characters, but in general ...
c = "%s" % '\x1a'
print c
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
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'
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.