用于print两个元素时自定义距离符(默以为两个空格)
关键字参数sep是完成分开符,比方多个参数输出时想要输出中心的分开字符
print(1, 2, 3, sep = ',', end = '\r\n') print(1, 2, 3, sep = ' ', end = '\r\n')
相干引荐:《python视频教程》
效果输出以下:
1,2,3 1 2 3
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 abc bcd fff poi-------------file abcbcdfff poi-------------file abc bcd fff poi-------------
以上就是python中sep是什么意义的细致内容,更多请关注ki4网别的相干文章!