Answer the question
In order to leave comments, you need to log in
How to read text with line breaks and store everything in a variable?
You can, of course, reset the variable with each new line, or add a new readable line to it
Answer the question
In order to leave comments, you need to log in
It's not entirely clear what the problem is:
text = "Строка 1\n" # считываем строку с переносом
text += "Строка 2\n" # добавляем еще строку с переносом
text += "Строка 3\n" # ...
print(text) # печатаем весь текст с переносами строк
# Строка 1
# Строка 2
# Строка 3
there is a special line break character "\n" for this,
for example:
print("Список продуктов:\nЯблоко\nМорковка\nКартошка")
Product list:
Apple
Carrot
Potato
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question