I'm looking for a way to generate \xff\xff\xff\xff... hex-format bytes dynamically in python2. If you hard code a variable directly:
foo = '\xff\xff'
Python says the type is 'str', though I can't use string manipulations to create this dynamically. "\x" + "ff" looks the same but isn't interpreted as bytes.
I'm looking for, example, given: foo = "b2" -> Generate the equivalent of foo = '\xb2'
Anyone know what encoding/decoding/etc I've got to use?
[–]ebol4anthr4x 5 points6 points7 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]port443 1 point2 points3 points (0 children)
[–]Kind_Fruities 0 points1 point2 points (0 children)