In Python, in order to print out text in the console, you can use the print() function. But by default, the print() will add a new line character (based on the OS \n, \r, or \r\n) at the end of the text that it printed out.
If you do not want to print text with a new line character at the end, you can use the end parameter of the print() function.
Example:print("I want to ",end='')
print("continue printing ",end='')
print("on the same line ",end='')
print("using Python print() ",end='')
Output on the same line as expected:
I want to continue printing on the same line using Python print()

More on the "end parameter"
-
The end parameter is used to specify the character or characters that should be printed at the end of the printed text using the print() function.
-
By default end parameter is set to a newline character i.e. \n
-
So when you use the default print() function in python, it always adds a newline character at the end of the text.
-
If you wish to change it to any other character, you can simply use the parameter end= followed by a character.
-
Let's have some fun!
In the below example, we have replaced the end parameter with an emoji and a new line.
print("Hello ",end='😀\n')
print("How are you? ",end='😀\n')
Output:
Hello 😀
How are you? 😀
Have Questions? Post them here!
- Check version of pip package installer for Python
- How to install Python 3.9 using brew on Mac
- Python Program To Calculate Simple Interest (SimpleInterest.py)
- Indent Python code in Notepad++
- Change label (text) color in tkinter
- Float built-in function in Python
- [Fix] ValueError: substring not found in Python
- pip get list of all outdated Python packages
- Calculate discount amount python code
- 3 Python program to add two numbers
- How to List all Packages installed using pip [Python]
- Python range() function examples
- How to resolve Failed to create interpreter PyCharm Error
- Format Python Code in Visual Studio Code (VS Code)
- Validate email address in Python using regular expression (regex)
- Install and Run Jupyter Notebook on Mac (macOS)
- How to delete a file using Python code example
- Base64 Encoding Decoding in Python Programming
- How to pip install Python Modules in VSCode
- Change the background of Tkinter label or text
- Comments in Python Programming
- Take input argument from command line in Python Programming
- How to Convert Python String to DateTime Object
- Tkinter - add x and y padding to label text
- [Tutorial] Install Python on Visual Studio Code (VS Code)
- How to clear Cache, Cookies and History on iPhone Safari - iOS
- Command to check Last Login or Reboot History of Users and TTYs - Linux
- Detect if Cookies are enabled using JavaScript - JavaScript
- Hyperlink in html (anchor tag) without a underline - Html
- How to Refresh Mac Desktop - MacOS
- DDMS files not found hprof-conv.exe - Android
- Multiple Microsoft 365 Services Down (Outlook, Teams, SharePoint, OneDrive) - 25 January 2023 (Solved) - Microsoft
- How to find the path of formula Installation by Brew - HowTos