首页 > 编程知识 正文

sep在python里是什么意思,sep在python中什么意思

时间:2023-05-06 04:39:09 阅读:280104 作者:2506

全称为Separate意为 分开 隔开

用于print两个元素时自定义间隔符(默认为两个空格)

关键字参数sep是实现分隔符,比如多个参数输出时想要输出中间的分隔字符

print(1, 2, 3, sep = ',', end = 'rn')

print(1, 2, 3, sep = ' ', end = 'rn')

相关推荐:《python视频教程》

结果输出如下:1,2,3

1 2 3print("filen","abc","bcd","fffn","poi")

print("-------------")

print("filen","abc","bcd","fffn","poi",sep='')

print("-------------")

print("filen","abc","bcd","fffn","poi",sep=' ')

print("-------------")

其结果为:file

abc bcd fff

poi-------------file

abcbcdfff

poi-------------file

abc bcd fff

poi-------------

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。