The print function uses sep
to separate the arguments, and end
after the last argument. Your example was confusing because you only gave it one argument. This example might be clearer:
>>> print('boa', 'cat', 'dog', sep=', ', end='!!!
')
boa, cat, dog!!!
Of course, sep
and end
only work in Python 3's print function. For Python 2, the following is equivalent.
>>> print ', '.join(['boa', 'cat', 'dog']) + '!!!'
boa, cat, dog!!!
You can also use a backported version of the print function in Python 2:
>>> from __future__ import print_function
>>> print('boa', 'cat', 'dog', sep=', ', end='!!!
')
boa, cat, dog!!!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…