python - How to convert each digit in an int to hex -


i want convert integer variable hex value digit wisely. means, 499, need output of "/x04/x09/x09". please help.

use string formatting functions:

n = 499 print("".join("\\x{0:02x}".format(int(i)) in str(n))) 

prints

\x04\x09\x09 

Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

sql server - SQL Query returns one result, does not return 0 or NULL result -