Python - How to print without newline

By xngo on June 8, 2019

By default, print() function will print the string with a new line. In order to print without new line, change the end parameter to empty string.

#!/usr/bin/python3
# Description: How to print without newline.
 
print("There is no newline. ", end="")
print("This is the second line.")

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.