F
F
FailureBij2021-07-29 19:12:46
Python
FailureBij, 2021-07-29 19:12:46

Perceives as text \n\n in python what to do?

I take the text from the database into the variable, in which \n\n are present, but when outputting the variable to the print, \n\n is displayed as text, and not as eol, what needs to be done so that it considers it as eol

s = 'вот текст\n\nНовая строчка'
print(s)

the output is: here is the text\n\nNew line
And it should be like this: here is the text
New line

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MinTnt, 2021-07-29
@FailureBij

print(s.replace("\\n", "\n"))?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question