pets = ['boa', 'cat', 'dog']
for pet in pets:
print(pet)
boa
cat
dog
>>> for pet in pets:
print(pet, end=', ')
boa, cat, dog,
>>> for pet in pets:
print(pet, end='!!! ')
boa!!! cat!!! dog!!!
Run Code Online (Sandbox Code Playgroud)
但是怎么样?我试图用sep替换end但是什么都没发生但是我知道sep在打印时用于separete,我如何以及何时可以使用sep?sep和end之间有什么区别?