end in Python

The end is a parameter in Python’s built-in print() function that controls what character(s) are printed at the end of the printed text. 

  • The end is set to \n (newline character) which means that each call to print() will print the output on a new line. 
  • we can change the value of the end to print a different character or string at the end of the printed text.

Syntax :

print(*objects, sep=’ ‘, end=’\n’, file=sys.stdout, flush=False)

Example :

Python




for i in range(1, 6):
    print i,


Output :

1 2 3 4 5

Difference between end and sep in Python

In this article we will discuss the difference between The end and sep are two parameters in Python’s built-in print() function that will help to control how the output is formatted.

Similar Reads

end in Python

The end is a parameter in Python’s built-in print() function that controls what character(s) are printed at the end of the printed text....

sep in Python

...

Difference Between end and sep in Python

the sep parameter is used to specify the separator between the values that are passed to the print() function....

Conclusion

...

Contact Us