My Command output is something like 0x53 0x48 0x41 0x53 0x48 0x49
. Now i need to store this in a hex value and then convert it to ASCII as SHASHI
.
What i tried-
- I tried to store the values in hex as
int("0x31",16)
then decode this to ASCII usingdecode("ascii")
but no luck. "0x31".decode("utf16")
this throws an errorAttributeError: 'str' object has no attribute 'decode'
Some other stuffs with random encoding and decoding whatever found through Google
. But still no luck.
Question :- How can i store a value in Hex like 0x53 0x48 0x41 0x53 0x48 0x49
and convert it's value as SHASHI
for verification.
Note: Not so friendly with Python, so please excuse if this is a novice question.
bytes
orbytearray
, which already acts like a list of ints. Then you don't need any of this code.