What is /n (backslash n)? Newline and Multiline Explained (with Python).

↔️ ↕️


what is backslash n encoding backslash n

is referred to as a newline character

it is part of a group of special

characters called escape sequences and

is used in many programming languages

such as c plus plus java and python

as the name implies the newline

character is used within string literals

to implement a new line

for example if i print hello world with

a backslash n between hello and world

here's what the output will show

here what is happening is the

interpreter will print hello

then execute this escape sequence to

move the cursor to the next line

then print world

the new line character is commonly used

within shorter string literal text to

add new lines

however there are situations where many

Related queries:

how to skip a line in python
how to skip new line in python