Set the end argument of print() to control what follows the text. Use end=' ' for a space between calls, or end='' to join their output directly.
print('Hello', end=' ')
print('world')
# Hello world
Use end to keep consecutive calls on one line
By default, print() ends its output with a newline (n), so the next call starts on a new line. Set end to a different string to change that behavior. The built-in function’s signature is print(*objects, sep=' ', end='n', file=None, flush=False). Python’s built-in functions reference describes the output as objects separated by sep and followed by end.
As an Amazon Associate I earn from qualifying purchases.
Join output without a gap
print('Loading', end='')
print('...')
# Loading...
Because the first call adds no trailing character, the second string begins immediately after Loading.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Keep a visible space between outputs
print('Hello', end=' ')
print('world')
# Hello world
Use a space when the output consists of words or values that would otherwise run together.
#1 Best Overall
Know when to use sep instead
sep separates multiple objects passed to a single print() call. end is added after all the objects in that call. Both are keyword arguments.
print('Name:', 'Ada', 'Lovelace', sep=' ', end='!n')
# Name: Ada Lovelace!
Changing sep will not stop separate calls from starting on new lines. To control the ending of each call, change end.
Rank #2
Rewrite a status line in a terminal
For terminal output that should update in place, use a carriage return (r) as the ending. It returns the cursor to the start of the current line:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsimport time
for percent in range(0, 101, 10):
print(f'Progress: {percent}%', end='r', flush=True)
time.sleep(0.1)
print() # finish the progress line
flush=True asks Python to flush the output stream promptly; it does not remove a newline. Buffering depends on the stream: interactive standard output is line-buffered, while non-interactive standard output is block-buffered. The Python sys reference documents standard output. Carriage-return updates are intended for terminal-style output; redirected output and logs may show each update instead of replacing a single visible line. If a new status is shorter than the previous one, leftover characters may remain on screen.
Use sys.stdout.write() for direct text output
For direct writes to standard output, use the write() method. Unlike print(), it does not automatically insert separators or an ending string, so include spaces or newlines yourself when needed.
import sys
sys.stdout.write('Hello')
sys.stdout.write(' worldn')
The Python tutorial’s file I/O section explains the write() method and standard text output.
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.
Free tools Windows power users keep installed
One-click scans. No signup required.




