Answer the question
In order to leave comments, you need to log in
How to return "raw lines" to their previous state?
I get the data from the sqlite database, they are in the form:
"Hello \nworld"
If you write print(abc), it will display Hello \nworld!
How do I get the \n characters to be escaped again?
Answer the question
In order to leave comments, you need to log in
It looks like the database has 'Hello \\nworld!' stored.
In this case, the quick fix is:
#Python 2.X
print '"Hello,\\nworld!"'.decode('string_escape')
#Python 3.X
print(b"Hello,\\nworld!".decode('unicode_escape'))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question