
Separate的全称意味着分离和分离。
自定义间隔符(默认为两个空格)用于print的两个元素
关键字参数sep是实现分离符,例如在输出多个参数时,要输出中间的分离字符。
print(1,2,3,sep=',',end='\r\n') print(1,2,3,sep='',end='\r\n')
结果输出如下:
1,2,3 123
print("file\n","abc","bcd","fff\n","poi")
print("-------------")
print("file\n","abc","bcd","fff\n","poi",sep='')
print("-------------")
print("file\n","abc","bcd","fff\n","poi",sep='')
print("-------------")其结果为:
file abcbcdfff poi-------------file abcbcdfff poi-------------file abcbcdfff poi-------------
python学习网络,大量免费python视频教程,欢迎在线学习!