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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -