I have a string my_string which holds a newline character. So, if printed it will introduce a new line.
Initially, I do my_string.encode('unicode_escape').decode("utf-8")
where print(my_string.encode('unicode_escape').decode("utf-8")) gives \n
and print (repr(my_string)) gives '\\n'.
Then, want I want to do is convert it back to its original state so that it prints the newline, i.e. my_string not to display the newline character \n or \\n but simply introduce a new line.
I searched for encode and decode but could not figure out how to do it.