How to print without a newline or space in Python?

Better Stack Team
Updated on January 26, 2023

To print without a new line, you need to provide one additional argument end and set its value to something other than the default \n which will break the line. You can set it to an empty character for example as shown below.

 
print('Hello', end='')
print(' world')

The output is a single line:

 
Hello world
Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →