How do you combine "\ x0" with a number (for example, 5) in python to form "\ x05"?

for example, I now have a variable:
num=5

then I need to fill in the value of this num to the position of the underscore in "x0_". How can I do that?

try 1:
x codeshelper id=0 0% s% (5)
so the x is "\ x05" instead of "x05"

Mar.04,2021

I don't know what you're going to do. We can only draw a picture according to the gourd.

num = 5
x = r'x0%s' % num
print x

x1 = 'x0' + str(num)
print x1

import binascii
num=5
binascii.a2b_hex(str(num).zfill(2))

is that what you want?

Menu