SyntaxFix
Write A Post
Hire A Developer
Questions
If you need even numbers of chars to be returned, you can use:
def int_to_hex(nr): h = format(int(nr), 'x') return '0' + h if len(h) % 2 else h
Example
int_to_hex(10) # returns: '0a'
and
int_to_hex(1000) # returns: '03e8'