D
D
Danil Samodurov2020-06-05 02:45:02
Python
Danil Samodurov, 2020-06-05 02:45:02

How to leave the \n character in a string?

Hello. How can I leave the \n character in a string? When outputting, these characters work as a line break, but I need the line to remain unchanged. If you enter 'str\ning' in the console, then the same is displayed, but if in IDLE print('str\ning') the output is already:

srt
ing

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Solomennikov, 2020-06-05
@samodurOFF

Screen.
print('str\\ning')

K
Kozhanov Maxim, 2020-06-05
@MaxPython375

print(r'str\ning')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question