Python - print function separators and end-of-line strings

Introduction

You can combine keyword arguments to specify both separators and end-of-line strings.

They may appear in any order but must appear after all the objects being printed:

Demo

x = 'test' 
y = 99 #  w w w .  j a v  a  2s.  co  m
z = ['eggs'] 

print(x, y, z, sep='...', end='!\n')          # Multiple keywords 
print(x, y, z, end='!\n', sep='...')          # Order doesn't matter

Result

Related Topic