What about this:
hex(dec).split('x')[-1]
Example:
>>> d = 30
>>> hex(d).split('x')[-1]
'1e'
By using -1 in the result of split(), this would work even if split returned a list of 1 element.
What about this:
hex(dec).split('x')[-1]
Example:
>>> d = 30
>>> hex(d).split('x')[-1]
'1e'
By using -1 in the result of split(), this would work even if split returned a list of 1 element.