Store in MongoDB database Different lines, for example:
"ABC \ N ABC" when trying to output it through print (my_string), I get a conclusion:
"ABC \ N ABC" instead of expected:
"abc ABC "
Here is the code:
my_string = get_one_string_from_bd () Print (My_String) Print (Type (My_String)) Print (REPR (My_String))
ABC \ N ABC & lt; class 'str' & gt; ABC \\ N ABC
What am I doing not as and how to make the row translation work?
The problem is solved if adding (n with two chopsticks, replaced by N with one stick, for some reason on this site is replaced by 1) .replace (“\ n”, “\ n”) to the string, but it is somehow strange.
Answer 1, Authority 100%
The database line does not contain a string translation character, it has a sequence of characters
N . The string was most likely converted to JS using
In order to restore the spacecraft in the row, you can use
my_string = my_string.encode ('latin1'). Decode. Encode ('Latin1 ') .Decode (' UTF8 ')
import codecs My_String = Codecs.escape_Decode (My_String)  .Decode ('Unicode-Escape')