-2

I would like to convert

the hex value

a = 0x32 

to a string d = 32

Bascially I have a numpy array

msg = np.array[2, 50]

I need to convert both values to hex --- [0x02 , 0x32] then print the hex values as strings on GUI as 2, 32

Mazdak
  • 105,000
  • 18
  • 159
  • 188
Jesh Kundem
  • 960
  • 3
  • 18
  • 30

1 Answers1

0

hex() will give you hex string. Then discard first 2 characters

>>> hex(a)
'0x32'
>>> hex(a)[2:]
'32'
>>> 

Looking at the link to duplicate, it seems numpy is giving you the L at the end since you are running 64bit linux. so do this:

hex(a)[2:-1]
joel goldstick
  • 4,393
  • 6
  • 30
  • 46