M
M
maragaz2021-09-19 00:30:31
Python
maragaz, 2021-09-19 00:30:31

How to extract text containing line breaks from sqlite database?

cur.execute("SELECT spamsg FROM addons")
                    spmmsg=cur.fetchall()
                    spmmsg1=str(spmmsg)


I have text:
Text1
Text2
Text3
When I print the value of spmmsg1 I get:
('Text1\n Text2\n Text3',)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kirillinyakin, 2021-09-19
@kirillinyakin

\n in python is a newline character, so when you output to the console, you will be fine. Try print(spmmsg[0])

G
GrayHorse, 2021-09-19
@GrayHorse

Replace '\\n'with '\n'in the string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question