I want to take an integer (that will be <= 255), to a hex string representation
e.g.: I want to pass in 65 and get out \'\\x41\', or
Also you can convert any number in any base to hex. Use this one line code here it's easy and simple to use:
hex(int(n,x)).replace("0x","")
You have a string n that is your number and x the base of that number. First, change it to integer and then to hex but hex has 0x at the first of it so with replace we remove it.