There are million questions and answers related to that but nothing worked with me.
I have a byte string that has escape characters, I want to decode it and convert it to string but without the escape characters and when printed it would be something like the following
>>> normal_string = "HellornWorld" >>> print(normal_string) Hello World
Here is a part of my byte string
>>> bytes_string = b'Normal sentencerntIndented sentencernanother one' >>> converted_string = str(bytes_string, 'utf-8') >>> print(converted_string) Normal sentencerntIndented sentencernanother one
and I want this
>>> print(string_that_I_want) Normal sentence Indented sentence another one
>>> print(bytes_string.decode("unicode_escape")) Normal sentence Indented sentence another one >>>