2

Python read a str '\\x0f' which is 4 chars('\\', 'x', '0' and 'f') but indeed I want to express it as one char which is '\x0f', is any way convert str '\\x0f' to char '\x0f'? Similarly, like converting '\\b' to '\b'.

stackKKK
  • 25
  • 1
  • 7
  • 1
    Does this answer your question? [How to un-escape a backslash-escaped string?](https://stackoverflow.com/questions/1885181/how-to-un-escape-a-backslash-escaped-string) – mousetail Dec 21 '19 at 10:07
  • 1
    `'\\x0f'` is actually `'\x0f'`, there is no need to convert it. Try `print('\\x0f')` and you will see the console print out `'\x0f'`. – 9mat Dec 21 '19 at 10:07
  • @mousetail [How to un-escape a backslash-escaped string?](https://stackoverflow.com/questions/1885181/how-to-un-escape-a-backslash-escaped-string) answers my question, thanks! – stackKKK Dec 21 '19 at 11:16

0 Answers0