Python’s built-in print() adds a newline after its output by default. Set end="" to add nothing, or end=" " to add a space, controlling where the next output begins.
What does the end parameter do?
The built-in function has this signature:
print(*objects, sep=' ', end='n', file=None, flush=False)
Python’s built-in reference describes it this way: “Print objects to the text stream file, separated by sep and followed by end.” In other words, print() writes its objects, then writes the value of end. The default, 'n', moves subsequent output to a new line.
As an Amazon Associate I earn from qualifying purchases.
The end, sep, file, and flush options are keyword arguments. end and sep accept a string or None; passing None selects the respective default. Even a call with no objects writes its end value.
How do I print without a newline?
Pass an empty string as end. This omits the usual newline, so the next output continues immediately after the first:
#1 Best Overall
print("Hello", end="")
print("world")
The output is Helloworld on one line. The second call uses its default newline, so output after world begins on the following line.
How do I keep output on the same line with a space?
Use end=" " to put a space after each printed value instead of a newline. For example:
Rank #2
for value in [1, 2, 3]:
print(value, end=" ")
print()
The loop writes 1 2 3 on one line, including a trailing space after 3. The final print() writes its default newline, moving any subsequent output to the next line.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →The Python input and output tutorial uses end=' ' to print table values in segments before the final value in each row. For a sequence where no separator is wanted between calls, use end="" instead.
How is end different from sep?
sep controls what goes between multiple objects in a single call; end controls what comes after all of them. For example:
print("red", "green", "blue", sep=", ", end="!")
This writes red, green, blue!: the comma and space separate the objects, while the exclamation mark is the ending text. Neither setting changes the other.
What do file and flush change?
file selects the text stream that receives the output; by default, it is sys.stdout. flush=True forces that stream to flush. These options affect the destination or handling of the output, not the suffix supplied by end. print() writes text; for a file opened in binary mode, use the file object’s write() method instead.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →For the accepted arguments and full behavior, see the Python built-in function reference. The IDLE documentation also illustrates print(s, end='') with the comment “Display s as is.”
Quick Recap
Best Value
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.




