Python end parameter in print()
By default Python‘s print() function ends with a newline. A programmer with C/C++ background may wonder how to print without a newline. Python’s print() function comes with a parameter called ‘end‘. By default, the value of this parameter is ‘\n’, i.e. the new line character.
Example 1:
Here, we can end a print statement with any character/string using this parameter.
Python3
# ends the output with a spaceprint("Welcome to", end = ' ')print("GeeksforGeeks", end= ' ') |
Output:
Welcome to GeeksforGeeks
Example 2:
One more program to demonstrate the working of the end parameter.
Python3
# ends the output with '@'print("Python", end='@')print("GeeksforGeeks") |
Output:
Python@GeeksforGeeks
Example 3:
The print() function uses the sep parameter to separate the arguments and ends after the last argument.
Python3
print('G','F', sep='', end='')print('G')#\n provides new line after printing the yearprint('09','12','2016', sep='-', end='\n') print('Red','Green','Blue', sep=',', end='@')print('geeksforgeeks') |
Output
GFG 09-12-2016 Red,Green,Blue@geeksforgeeks

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.


