I need to add an escape character to a variable which I'm appending to another string and have it apply its effects. This is what I have:
h1 = ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
h2 = ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
h3 = list(itertools.product(h1, h2))
h4 = []
for item in h3:
h4.append(''.join(item))
temp = r'\x' + str(h4[0]) + '\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c'
So if i have \xh I need the character with hex value hh but I can't seem to find anything in python that does this besides \x which I can't seem to use on variables.
Any suggestions?
unicodeor Py3str), you don't need to actually make an escape code to convert ordinals tobytes/strvalues. The answers are explaining how you skip the escapes and get what you actually want?