How to convert text to \x codes?

后端 未结 6 1528
别跟我提以往
别跟我提以往 2021-01-06 02:27

I want to convert normal text to \\x codes for e.g \\x14\\x65\\x60

For example :

normal text = \"base64_decode\"
converted \\x codes for above text =         


        
6条回答
  •  天命终不由人
    2021-01-06 02:53

    The ord() function gives you the decimal value for a single byte. dechex() converts it to hex. So to do this, loop through the every character in the string and apply both functions.

提交回复
热议问题