Free tools Windows power users keep installed
One-click scans. No signup required.
Use n inside a regular string to make a line break at a specific point, or rely on print()’s default ending to move to the next line after a value. For example, print(f"Hello, {name}nWelcome!") prints a greeting with the variable and welcome message on separate lines.
Put a line break inside a string
In a regular Python string, the escape sequence n represents a linefeed. Put it where the output should break:
print("First linenSecond line")
That prints:
First line
Second line
The backslash and lowercase n are typed in the source code; Python interprets them as one linefeed in the string. The Python 3.14.8 lexical analysis reference documents this escape sequence.
Print a new line after a variable
For a line break after a variable, a separate print() call is usually simplest. By default, each call ends with a newline:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
name = "Ada"
print(name)
print("Welcome")
The output is:
Ada
Welcome
To include the variable and a line break within one composed string, use an f-string:
name = "Ada"
message = f"Hello, {name}nWelcome!"
print(message)
This prints:
Hello, Ada
Welcome!
Expressions in f-string braces are substituted, and escape sequences in the f-string’s ordinary literal text are interpreted. See the Python 3.14.8 tutorial on input and output.
Rank #2
Choose between a string newline and print’s ending
These methods place the break in different places: n is part of the string, while print() adds its ending after the objects it prints. The built-in function’s end parameter defaults to 'n', so consecutive calls normally start on separate lines. The Python reference describes the behavior this way: “Print objects to the text stream file, separated by sep and followed by end.”
| Method | Where the break comes from | Example |
|---|---|---|
| Newline in a string | A linefeed inside the string, wherever n appears |
print("AnB") |
| Separate calls | The default end='n' at the end of each call |
print(name); print(city) |
| Custom ending | The value supplied to end after the printed objects |
print(name, end="") |
The Python 3.14.8 built-in functions reference documents print(), including its sep and end parameters.
Recommended Free Tools
Control whether print adds a line break
Set end to change what print() appends after its output:
print(name, end="")suppresses the ending newline.print(name, end="nn")adds two linefeeds after the value, leaving a blank line before subsequent output.
For example, this keeps the first two pieces of text on the same line:
print("Hello", end="")
print(" there")
The second call contributes its text and then its own default newline.
Add a blank line or put several values on separate lines
To leave one blank line between sections, either include a linefeed in the string and allow print() to add its usual ending, or set the ending explicitly:
Best Value
print("Section onen")
print("Section two")
# Alternatively:
print("Section one", end="nn")
print("Section two")
You can also use sep to place multiple objects on separate lines in a single call. It sets the separator between objects:
print(name, city, sep="n")
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Avoid these newline mistakes
- Using a raw string:
r"n"keeps the backslash andnas literal characters. Use"n"when you want an active line break. - Getting an extra break:
print("Hellon")has a linefeed inside the string and also getsprint()’s default ending. Useprint("Hello", end="")if you want to omit the automatic ending. - Expecting braces to substitute a variable:
print("{name}")prints the literal text{name}. Useprint(f"{name}n")for an f-string, orprint("{}n".format(name)). - Confusing printed output with a representation:
print(value)displays a string’s contents;repr(value)shows a representation that can include quotes and escaped characters. The distinction is covered in the Python input and output tutorial.
Where print sends the output
By default, print() writes to sys.stdout. Its file= parameter can direct output to a file-like text stream instead. A terminal, IDE, or other output consumer determines how control characters appear on screen; the Python syntax specifies the linefeed, not the rendering behavior of every display.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




