I decided to create a small program that accepts hexadecimal code
646с726а77206а6с6с6548 And converts to
\x48\x65\x6c\x6c\x6f\x20\x77\x6f\x72\x6c\x64 But I do not understand how to do this?
There have been attempts
a = "646с726а77206а6с6с6548" b = a[::-1] hexcode = "" for i in b: hexcode+=b But I do not know how to do it so that the cycle throws 2 symbols at a time?
for i in range(0, len(a), 2): hexcode = a[i:i+2] + hexcodebut this is not “pitonic”;) - MBohexcode = "\x"two characters in the variablehexcode = "\x"that would result in "\ x48 \ x65 \ x6c" - kombat